/* Calculate BMI index of peoples using 2D array */ #include<stdio.h> #include<conio.h> void main(){ int n,j,i; float person[10][2],BMI[10]; clrscr(); printf("\nEnter the number of persons.."); scanf("%d",&n); printf("\nEnter Weight and Height for each person"); printf("\n***************************************"); for(i=0;i<n;i++){ printf("\nPerson %d",i+1); for(j=0;j<2;j++){ if(j==0){ printf("\nEnter Weight (Kg) of person %d...",i+1); scanf("%f",&person[i][0]); } if(j==1){ printf("\nEnter Height (m) of person %d...",i+1); scanf("%f",&person[i][1]); } } } //Calculation BMI Index for each person for(i=0;i<n;i++){ BMI[i]=person[i][0]/(person[i][1]*person[i][1]); printf("\nBMI of person %d is %.2f",i,BMI[i]); } getch(); }