/* program to input the age of students and find the youngest among them*/
#include<stdio.h>
#include<conio.h>
main()
{
int i,n,age[100],temp=0;
printf ("Enter the number of student:");
scanf("%d",&n);
printf("\n Enter the age of student:");
for(i=0;i<n;i++)
{
scanf("%d",&age[i]);
}
temp=age[0];
for(i=0;i<n;i++)
{
if(age[i]<temp)
{
temp=age[i];
}
}
//printing the age of youngest student
printf("\n The age of youngest student is: %d",temp);
getch();
}
No comments:
Post a Comment