Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* program to find name and count of students with age<25 & weight <50*/
- #include<stdio.h>
- #include<conio.h>
- void main()
- {
- char ch;
- do
- {
- int n,count=0;
- float i=1,wt,age=0;
- char name[10];
- clrscr();
- printf("Enter number of students: ");
- scanf("%d",&n);
- while(i<=n)
- {
- printf("\nName of student: ");
- scanf("%s",&name);
- printf("His/Her age: ");
- scanf("%f",&age);
- printf("His/Her weight: ");
- scanf("%f",&wt);
- i++;
- if(age<25 && wt<50)
- {
- count=count+1;
- printf("\n%s has age<25 & weight<50",name);
- }
- }
- printf("\n%d students has age<25 & weight<50",count);
- printf("\nDo you want to continue? (y/n)");
- fflush(stdin);
- scanf("%c",&ch);
- }
- while(ch=='y');
- getch();
- }
Advertisement
Add Comment
Please, Sign In to add comment