Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
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.
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:
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.