fork(1) download
  1. #include <stdio.h>
  2.  
  3. struct Body{
  4. int id;
  5. int height;
  6. int weight;
  7. double bmi;
  8. };
  9.  
  10. int main(void)
  11. {
  12. struct Body data[]={{1,170,60},{2,150,50},{3,160,56},{4,180,70}};
  13. for(int i=0;i<4;i++){
  14. data[i].bmi=data[i].weight/(data[i].height/100);
  15. printf("id %d :%lf\n",data[i].id,data[i].bmi);
  16. }
  17.  
  18. return 0;
  19. }
  20.  
Success #stdin #stdout 0.01s 5288KB
stdin
Standard input is empty
stdout
id 1 :60.000000
id 2 :50.000000
id 3 :56.000000
id 4 :70.000000