Sei sulla pagina 1di 6

Q1) write a program that takes two integers from user and computes the quotient and remainder.

Q2) write a program to find the ASCII value of a character.

Q3) write a program to swap two variables with and without using temp variable.

Q4) Write a program which accepts amount as integer and display total number of Notes of Rs.
500, 100, 50, 20, 10, 5 and 1.
For example, when user enter a number, 575,
the results would be like this...
500: 1
100: 0
50: 1
20: 1
10: 0
5: 1
1: 0

Q5) Write a program which accepts a character and display its next character.

Q6) Write a program which accepts days as integer and display total number of years, months
and days in it.
for example : If user input as 856 days the output should be 2 years 4 months 6 days.

Q7) Ask user to enter three numbers and find largest number among three numbers using nested
if-else.

Q8) write a program to to find greatest common divisor of two integers.

Q9) Make a simple calculator to add,subtract,multiply and divide using switch case.

Q 10) write a program that takes a three digit number and check whether given number is
Armstrong number. Hint ( A positive integer is called an Armstrong number if the sum of cubes
of individual digit is equal to that number itself. For example:

153 = 1 * 1 * 1 + 5 * 5 * 5 + 3 * 3 * 3 // 153 is an Armstrong number.

12 is not equal to 1 * 1 * 1 + 2 * 2 * 2 // 12 is not an Armstrong number.)

Q 11) Rewrite above program to find Armstrong numbers between two intervals. Hint (100-400).

Q12) write a program to display factors of a positive integer. (Entered by the user). Hint( Factors
of 60 are 1 2 3 4 5 6 12 15 20 30 60).

Q 13) write a program to find size of int, float, double ,chat. Using sizeof() operator.
Q 14) Write programs to draw the following patterns.

a) * ****
* ***
* **
* *
*
b)

*****

****

***

**

c)

*****

*****

*****

*****

*****
d)

* *

* *

* *

* * * * *

e)

* *

* *

* *

* * * * *

f)

***

*****

*******

*********
g)

*********

*******

*****

***

h)

**

***

****

*****

****

***

**

*
I)

**

***

****

*****

****

***

**

j)

***

*****

*******

*********

*******

*****

***

*
Q.15 program takes n number of element from user (where, n is specified by user) and stores
data in an array. Then, this program displays the largest element of that array using loops.

Q.16) Explore insertion sort.

Potrebbero piacerti anche