23. Read five persons height and weight and count the number of person having height greater than 170 and weight less than 50,
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,str[5][2],count=0;
printf("Enter Height and Weight:\n");
for(i=0;i<5;i++)
{
for(j=0;j<2;j++)
{
scanf("%d",&str[i][j]);
}
}
for(i=0;i<5;i++)
{
for(j=0;j<2;j++)
{
if(str[i][0]>=170 && str[i][j]<=50)
{
count++;
}
}
}
printf("Number of Students= %d",count);
getch();
}
#OUTPUT:
#include<conio.h>
void main()
{
int i,j,str[5][2],count=0;
printf("Enter Height and Weight:\n");
for(i=0;i<5;i++)
{
for(j=0;j<2;j++)
{
scanf("%d",&str[i][j]);
}
}
for(i=0;i<5;i++)
{
for(j=0;j<2;j++)
{
if(str[i][0]>=170 && str[i][j]<=50)
{
count++;
}
}
}
printf("Number of Students= %d",count);
getch();
}
#OUTPUT:
Comments
Post a Comment