Advertisement
pranto_95

Input 5 students age and find how many of them are young

Jun 18th, 2015
266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.33 KB | None | 0 0
  1. /*Input 5 students age and find how many of them are younger than last student*/
  2.  
  3. #include<stdio.h>
  4. int main(){
  5.     int i,x[5],c=0;
  6.     for(i=0;i<5;i++){
  7.         scanf("%d",&x[i]);
  8.     }
  9.     for(i=0;i<5;i++){
  10.             if(x[i]<x[4]){
  11.                     c++;
  12.             }
  13.     }
  14.     printf("%d",c);
  15.  
  16.     return 0;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement