Decision Making (Using if )theory

 Decision Making Using if

1) keyword is a reserved word i.e a word which is already available in c language .there are 32 keywords available in c language.

2) if is a keyword is used to check condition and that basis we can take some decision , decision is based on whether the condition is true or false

syntax :

1) if  (condition)

                        true part;( i.e statement1)

2) if  (condition)

                        true part;( i.e statement1)

    else
                       false part; (i.e statement1)


3) if  (condition)
{                       statement 1;

                         statement 2;

                         statement 3;

}

    else

                         statement ;

4)  if  (condition)

{                       statement 1;

                         statement 2;

                                |

                                |

                         statement n;

}

    else

{                       statement 1;

                         statement 2;

                                |

                                |

                         statement n;

}

Example :--

/* program to find out the result pass or fail on the basis of marks of student where 35 and 35 above is pass*/

#include<stdio.h>

#include<conio.>

void main()

{                int marks;

                  clrscr();

                  printf(" \n Enter the your marks =" );

                  scanf("%d",&marks);

                  if(marks>=35)

                                        printf(" pass");

                  else

                                        printf(" fail ");

                  getch();

}


/* output :---

 Enter the your marks = 45

  pass

*/


                                                                 ðŸ’¬ðŸ˜ŠðŸ˜‰ðŸ‘Œ

No comments:

Post a Comment

This Blog helps you to learn basics to high level programming coding and practicals.
conceptual understanding

c program, Advance coding, c++ program, simple program, Advance language

online quiz Application project page MCA final year project

  Here we making a quiz application ppt presentation for college project so that our project idea will like to our professor and teacher  fi...