$25
Question 1
Draw a flowchart to input an integer from the keyboard and display whether the number is positive, negative or zero. If the number is > 0 display “number is positive”. If number is zero display “ Number is zero”. Otherwise display “Number is negative”.
Convert the flowchart to a C program.
Question 2
Draw a flow chart to enter a number from the keyboard and print whether it is an even number or an odd number.
Convert the flowchart to a C program.
Question 3
A palindrome is a number or a text phrase that reads the same backward as forward. For example 12321, 45554. Write a C program that reads a five-digit integer and determines whether it is a palindrome or not.
Question 4
Write a C program to input the grade from the keyboard and print the respective messages. (Use if-else statements and upper and lower case both should be allowed when entering the grade)
Grade
Message
A
Excellent
B
Good
C
Satisfactory
F
Needs Improvement
Question 5
Re-write the answer for question 4 using switch statements.
Question 6
Convert the following switch statement to an equivalent if-else statement.
switch ( grade ) {
case 'A' : printf( "Excellent \n");
break;
case 'B' : printf( "Good \n”); break;
case 'c' :
case 'C' : printf( "OK \n"); break;
default : printf( "Needs Improvement\n”);
}
Question 7
A company calculates the bonus given to their employees based on the employee category. Write a C program to input the employee category and basic salary and calculate the bonus amount.
Employee category Bonus percentage
1 5%
2 10%
3 15%
Bonus = Basic_Salary * Bonus_Rate