Guest User

Untitled

a guest
Apr 23rd, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.70 KB | None | 0 0
  1. #include<stdio.h>
  2.  
  3. int main()
  4. {
  5.    int per;
  6.    while(1)
  7.    {
  8.     printf("Enter your percentage: ");
  9.     scanf("%d", &per);
  10.     if (per >= 100 || per<=0)
  11.     {
  12.             printf("Invalid percentage!\n Please retry."); 
  13.     }
  14.     else
  15.         break;
  16.    }  
  17.    if (per >= 75) {
  18.      printf("You have passed in distinction\n");
  19.    }
  20.    else if (per >= 60) {
  21.      printf("You have passed in first class\n");
  22.    }
  23.    else if (per >= 50) {
  24.      printf("You have passed in second class\n");
  25.    }
  26.    else if (per>= 40) {
  27.      printf("you have passed in thrid class\n");
  28.    }
  29.    else if (per>= 35) {
  30.      printf("You have passed\n");
  31.    }
  32.    else {
  33.      printf("better luck next time\n");
  34.    }
  35.    return 0;
  36. }
Add Comment
Please, Sign In to add comment