Assignment 3: Selection statements and Loops solved
You must demo all your work during your lab session and before exiting the lab. And
submit the lab work in the blackboard.
1. Write a program that calculates how many digits a number contains:
Enter a number: 374
The number 374 has 3 digits
You may assume that the number has no more than four digits.
2. Write a program that finds the largest and smallest of four integers entered by the
Enter four integers: 21 43 10 35
Use as few if statements as possible.
3. Using the switch statement, write a program that converts a numerical grade into a
Enter numerical grade: 84
Letter grade: B
Use the following grading scale: A=90-100, B=80-89, C=70-79, D=60-69, F=0-59.
Print an error message if the grade is larger than 100 or less than 0.
Write pseudocode to solve the given problems.
Write C program to solve the above problems. Name your file Lab3_YourName.c
You'll get 1 file (123.9KB)