Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

ICS

Drafted by Sadia Ahmmed

Draw a flowchart for the given problems:

1. Write a C program to accept two integers and check whether they are equal or not.
Input : 18 18
Expected Output :
Number 1 and Number 2 are equal

2. Write a C program to check whether a given number is even or odd.


Input: 13
Expected Output :
13 is an odd integer

3. Write a C program to check whether a given number is positive or negative.


Input : 5
Expected Output :
5 is a positive number

4. Write a C program to find the perimeter of a rectangle. Length and Width of the rectangle will be
provided by the user from the keyboard.

Sample Input Sample Output

5 10 30

12 36 96

5. Write a C program to find the largest of three numbers.


Input : 1 2 5
Expected Output :
The 3rd Number is the greatest

6. Write a C program where the user first inputs ‘q’ or ‘r’ If the input is q then find the quotient
from the division of two numbers and if the input is r then find reminder.
Sample Input Sample Output

q 5
32 6

r 1
63 2

7. Write a program that asks the user for an integer and then prints whether the number is even or
odd.

Sample Input Sample Output

7 odd

12 even

8. Write a program that asks the user for their age and then prints whether they are eligible to vote
(age 18 or older).

Sample Input Sample Output

Enter your age: 12 You are not eligible to vote.

Enter your age: 20 You are eligible to vote.

9. Write a C program to accept a coordinate point in an XY coordinate system and determine in


which quadrant the coordinate point lies.

Input : 7 9

Expected Output :

The coordinate point (7,8) lies in the First quadrant.

10. Create a calculator with 4 options. The user will input 2 numbers and a character like +, - , *
and / symbol. Based on the character input the program will complete the action of addition
subtraction multiplication or division and show result

Sample Input Sample Output


/ 5
32 6

+ 65
63 2

11. Write a C program to read temperature in centigrade and display a suitable message according
to the temperature state below:

Temp < 0 then Freezing

Temp 0-10 then Very Cold

Temp 10-20 then Cold

Temp 20-30 then Normal

Temp 30-40 then Hot

Temp >=40 then Very Hot

Input :

42

Expected Output :

Its very hot.

12. Write a program that asks the user for three integers and then prints the smallest of the three.

Sample Input Sample Output

Enter first number: 3 The smallest number is: 3


Enter second number: 9
Enter third number: 5

13. Swap two numbers

[Hint: use another variable?]

Sample Input Sample Output

a=2, b=3 a=3 b=2

You might also like