Skip to main content

example of if-else-if ladder in C

// example of if-else-if ladder in C

#include <stdio.h> 

int main() { 
   int i = 20

   if (i == 10
      printf("i is 10"); 
   else if (i == 15
      printf("i is 15"); 
   else if (i == 20
      printf("i is 20"); 
   else
      printf("i is not present"); 

Comments

Popular posts from this blog

example of typecasting in c

/*Type Casting in C Typecasting allows us to convert one data type into other. */ //simple example to cast int value into the float. #include <stdio.h>    int   main (){   float   f = ( float ) 9 / 4 ;     printf ( "f : %f \n " ,  f  );     return   0 ;   }