Advertisement
anonymzz

Method 1

Mar 15th, 2023
830
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.88 KB | None | 0 0
  1. /*
  2. ---------------------------------------------------------------------------------
  3.   Method 1
  4. ---------------------------------------------------------------------------------
  5. */
  6. #include <stdio.h>
  7.  
  8. int main(void)
  9. {
  10.     int marks, sum = 0, modCount = 1, stdCount = 1, high = 0, highstd = 0;
  11.  
  12.     while (stdCount <= 3)
  13.     {
  14.         while (modCount <= 4)
  15.         {
  16.             printf("Enter Student 0%d Module %d Marks: ", stdCount, modCount);
  17.             scanf("%d", &marks);
  18.  
  19.             sum = sum + marks;
  20.             modCount++;
  21.         }
  22.  
  23.         printf("Student 0%d Total Marks = %d\n\n", stdCount, sum);
  24.  
  25.         if (high < sum)
  26.         {
  27.             high = sum;
  28.             highstd = stdCount;
  29.         }
  30.  
  31.         modCount = 1;
  32.         sum = 0;
  33.         stdCount++;
  34.     }
  35.  
  36.     printf("Highest Total Marks = %d by Student %d\n", high, highstd);
  37.  
  38.     return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement