Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Assignment #4
- 1)
- A: True
- B: False
- C: True
- 2)
- A: just right
- weight tested
- B: middle age
- 3)
- #include <stdio.h>
- #include <stdlib.h>
- int main()
- {
- float score;
- scanf("%f", &score);
- if (score<0.0 || score>4.0)
- printf("Invalid input");
- else if (score>=3.5)
- printf("Highest honors for semester");
- else if (score>=3.0)
- printf("Dean's list for semester");
- else if (score>=2.0)
- printf("");
- else if (score>=1.0)
- printf("On probation for next semester");
- else if (score>=0.0)
- printf("Failed semester-registration suspended");
- }
- 4)
- #include <stdio.h>
- #include <stdlib.h>
- int main()
- {
- float kg, cm, m, bmi;
- printf("Enter your weight (kg) and height (cm): ");
- scanf("%f %f", &kg, &cm);
- m=cm/100; //converting cm to meters
- bmi=kg/(m*m);
- printf("Your BMI is: %f", bmi);
- }
- 5)
- #include <stdio.h>
- #include <stdlib.h>
- int main()
- {
- float n;
- printf("Enter data usage in gbs: ");
- scanf("%f", &n);
- printf("Your charges: ");
- if (n>10.0)
- printf("2000");
- else if (n>=5.0)
- printf("1500");
- else if (n>=2)
- printf("1000");
- else if (n>=1)
- printf("500");
- else if (n>0)
- printf("250");
- else
- printf("ERROR!\nPlease enter a positive number.");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement