Advertisement
Guest User

Untitled

a guest
Apr 3rd, 2020
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.36 KB | None | 0 0
  1. Assignment #4
  2.  
  3. 1)
  4. A: True
  5. B: False
  6. C: True
  7.  
  8. 2)
  9. A: just right
  10.    weight tested
  11. B: middle age
  12.  
  13. 3)
  14. #include <stdio.h>
  15. #include <stdlib.h>
  16. int main()
  17. {
  18.     float score;
  19.     scanf("%f", &score);
  20.     if (score<0.0 || score>4.0)
  21.         printf("Invalid input");
  22.     else if (score>=3.5)
  23.         printf("Highest honors for semester");
  24.     else if (score>=3.0)
  25.         printf("Dean's list for semester");
  26.     else if (score>=2.0)
  27.         printf("");
  28.     else if (score>=1.0)
  29.         printf("On probation for next semester");
  30.     else if (score>=0.0)
  31.         printf("Failed semester-registration suspended");
  32. }
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40. 4)
  41. #include <stdio.h>
  42. #include <stdlib.h>
  43. int main()
  44. {
  45.     float kg, cm, m, bmi;
  46.     printf("Enter your weight (kg) and height (cm): ");
  47.     scanf("%f %f", &kg, &cm);
  48.     m=cm/100; //converting cm to meters
  49.     bmi=kg/(m*m);
  50.     printf("Your BMI is: %f", bmi);
  51. }
  52.  
  53.  
  54. 5)
  55. #include <stdio.h>
  56. #include <stdlib.h>
  57. int main()
  58. {
  59.     float n;
  60.     printf("Enter data usage in gbs: ");
  61.     scanf("%f", &n);
  62.     printf("Your charges: ");
  63.     if (n>10.0)
  64.         printf("2000");
  65.     else if (n>=5.0)
  66.         printf("1500");
  67.     else if (n>=2)
  68.         printf("1000");
  69.     else if (n>=1)
  70.         printf("500");
  71.     else if (n>0)
  72.         printf("250");
  73.     else
  74.         printf("ERROR!\nPlease enter a positive number.");
  75. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement