Skip to main content

simple example of if-else statement

#include<stdio.h>
int main()
{
   int age;
   char name [20];
   printf("Enter your name\n");
   scanf("%s",&name);
   printf("Enter your age\n");
   scanf("%d",&age);
   if (age<40)
   {
      printf("hello %s welcome to youth party club",name);
   }
   else
   {
      printf("hello %s welcome to old party club ",name);
   }
   
   
   return 0;
}
01

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 ;   }