A university recently conducted a survey with regards to demographics and programmes in which students are enrolled. To this end, they asked 15 students the following questions: In what programme are you enrolled? Responses are C for Civil Engineering, I for ICT, M for Mechanical Eng., P for Process & Utilities. Note that the response could be in any case. What is your age? Write a C program to input this data for the 15 students and to output (a) the percentage of students who enrolled in ICT, and (b) the percentage of students who are enrolled in Civil Eng. and who are under the age of 30. Use the switch statement in your program.
Control structures
Control structures are block of statements that analyze the value of variables and determine the flow of execution based on those values. When a program is running, the CPU executes the code line by line. After sometime, the program reaches the point where it has to make a decision on whether it has to go to another part of the code or repeat execution of certain part of the code. These results affect the flow of the program's code and these are called control structures.
Switch Statement
The switch statement is a key feature that is used by the programmers a lot in the world of programming and coding, as well as in information technology in general. The switch statement is a selection control mechanism that allows the variable value to change the order of the individual statements in the software execution via search.
A university recently conducted a survey with regards to demographics and programmes in which students are enrolled.
To this end, they asked 15 students the following questions:
In what programme are you enrolled? Responses are C for Civil Engineering, I for ICT, M for
What is your age?
Write a C
Step by step
Solved in 2 steps with 1 images