Basic C Programming Question

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

Chapter 1 4

Note: Chap1- Chap4 as I was suggested you in the class (Algorithms: such as flowchart or
Pseudocode, Area of any shapes, Data in C)
Additional questions for Chapter 4
1. Design a program that inputs a character (small capital letter) from the user and determines if
the character is a vowel. Display a message on the screen if the character is a vowel or not a
vowel.
2. Design a C program that inputs an integer income from the user, calculates and prints the tax
imposed based on the following assumptions:
if income < 2500, no tax
if 2500 income 4500, tax rate = 450 + 10% above 3500
if income > 4500, tax rate = 600 + 20% above 6000
2. Write for statements to print the following sequence of values:
i.
1, 3, 5, 7, 9
ii.
11, 7, 3, -1, -5
iii.
80, 40, 20, 10, 5
iv.
2, 6, 18, 54, 162
3. Given the following program segment:
int x = 10;
while ( x > 4 ) {
printf("%d " ,x);
x = x-2;
}
printf("%d" ,x);

What is the output of the program segment above?


4. Write a program segment to display the following sequence using:
12 6 3 1
i.

ii.
iii.

while statement
for statement

do-while statement

Suggestion: Please go through and practice more on Tutorial Questions (Sections B and C),
Lecture notes, Text Book (Guided Exercises, Extra Exercises)

You might also like