AbdulFathaah

ageweight

Sep 26th, 2023
20
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. /* program to find name and count of students with age<25 & weight <50*/
  2.  
  3. #include<stdio.h>
  4. #include<conio.h>
  5. void main()
  6. {
  7. char ch;
  8. do
  9. {
  10. int n,count=0;
  11. float i=1,wt,age=0;
  12. char name[10];
  13. clrscr();
  14. printf("Enter number of students: ");
  15. scanf("%d",&n);
  16. while(i<=n)
  17. {
  18. printf("\nName of student: ");
  19. scanf("%s",&name);
  20. printf("His/Her age: ");
  21. scanf("%f",&age);
  22. printf("His/Her weight: ");
  23. scanf("%f",&wt);
  24. i++;
  25. if(age<25 && wt<50)
  26. {
  27. count=count+1;
  28. printf("\n%s has age<25 & weight<50",name);
  29. }
  30. }
  31. printf("\n%d students has age<25 & weight<50",count);
  32. printf("\nDo you want to continue? (y/n)");
  33. fflush(stdin);
  34. scanf("%c",&ch);
  35. }
  36. while(ch=='y');
  37. getch();
  38. }
  39.  
  40. 
Advertisement
Add Comment
Please, Sign In to add comment