Sunday, August 31, 2014

If the ages of three students are input through the keyboard, write a program to determine the youpgest of the three.


Code

#include<stdio.h>
int main()
{
int agea,ageb,agec;
printf ("Enter age of Ali, Shan and irfan: ");
scanf("%d%d%d",&agea,&ageb,&agec);
if(agea<ageb&&agea<agec)
{
printf("\nAli is youngest ");
}
else if(ageb<agea&&ageb<agec)
{
printf("\nShan is youngest");
}
else if(agec<agea&&agec<ageb)
{
printf("\nirfan is youngest");
}

printf ("\n\nPress any key to close.");

getch ();
return 0;
}

Output

find youngest person c language


No comments :

Post a Comment

Note: Only a member of this blog may post a comment.

Copyright 2017. All Rights Reserved. Privacy Policy / Terms And Conditions / Sitemap / Contact