Skip to main content

Posts

Showing posts from September, 2018

Use of else if to find largest among three in C

            Largest among three using else if   #include<stdio.h> #include<conio.h> void main() { int a,b,c; printf(“Enter three values\n”); scanf(“%d%d%d”,&a,&b,&c); printf(“\n Largest value is “); if(a>b && a>c)    {         printf(“%d\n”,a);    } elseif(b>a && b>c) {       printf(“%d\n”,b);   }                                         else {        printf(“%d\n”,c); } getch();   }

Use else if with example total of marks and percentage & Grade in C

    Use else if with example ( total of marks and percentage & Grade ) "else if" It remove the above problem but it has own problem it check all the condition until one condition is true. So it is time consuming. Syntax:-                                              If(condition1)                                                 {                           ...