Thursday, October 13, 2011

IF Statement (Age)


Write a program that will display "Pretty Young" if age is lesser than 18,
and will display "You Old" if age is  greater than 18.


(Solution)




#include<stdio.h>
   #include<conio.h>

   int main()
   {
          int AGE;
     
          printf("Enter age:");
          scanf("%d",&AGE);
   
          if ( AGE <= 18 )
         {
               printf("Pretty Young!");
         }
         else    
        {
               printf("Your Old!");
       }
       getch();
       return 0;
}

0 comments:

Post a Comment