Advertisement
arjanzkie123

Untitled

Sep 3rd, 2014
2,615
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<stdio.h>//preprocessor directive
  2. int main()
  3. {
  4.     //Local Declarations
  5.  
  6.           int i;
  7.           float grade,unit,prod,prodt=0,unitt=0,GPA=0;
  8.          
  9.           printf("grade\tunit\n");
  10.           for(i=1;i<=7;i++)
  11.           {
  12.                         scanf("%f %f",&grade,&unit);
  13.                         prod=grade*unit;
  14.                         prodt+=prod;
  15.                         unitt+=unit;
  16.           }
  17.          
  18.           GPA=prodt/unitt;
  19.          
  20.           printf("Your GPA is%.2f\n",GPA);
  21.           if (GPA>=3.0)
  22.              printf("You Passed\n");
  23.           else
  24.               printf("You Failed\n");
  25. getch();
  26. return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement