Professional Documents
Culture Documents
1. Write a program in C++ to add two numbers & print result, assume any two numbers.
2. Write a program to print following text.
3. Write a program to display the following output using a single cout statement.
4. Write a program to print Pyramid & Horizontal Diamond using escape sequences.
1. Write a C program to accept two integers and check whether they are equal or not.
2. Write a program that prompts the user to input a number. The program should then
output the number and a message saying whether the number is positive, negative,
or zero.
3. Write a program that prompts the user to input four numbers. The program should
then output the numbers in ascending order.
4. Write a program in C to read any Month Number in integer and display Month
name in the word.
5. Write a program in C to calculate and print the Electricity bill of a given customer.
The customer id., name and unit consumed by the user should be taken from the
keyboard and display the total amount to pay to the customer. The charge are as
follow :
Unit Charge/unit
600
If bill exceeds Rs. 400 then a surcharge of 15% will be charged and the minimum bill
should be of Rs. 100/-
Sample Input :
1001
James
800
Sample Output:
Customer IDNO :1001
Customer Name :James
Units Consumed :800
Amount Charges @Rs. 2.00 per unit : 1600.00
Surcharge Amount : 240.00
Net Amount Paid By the Customer : 1840.00
6. Write a program in C to accept a grade and declare the equivalent description:
Grade Description
E Excellent
V Very Good
G Good
A Average
F Fail
1. Write a program in C++ to make such a pattern like right angle triangle
with
number increased by 1.
Output Sample:
Enter a number: 4
1
23
456
7 8 9 10
Output Sample 2:
Enter a number: 6
1
23
456
7 8 9 10
11 12 13 14 15
16 17 18 19 20 21
2. Write a program in C++ to make such a pattern like a
pyramid with numbers increased by 1.
1
23
456
7 8 9 10
3. Write a program in C++ to display a diamond.
*
***
*****
*******
*********
*******
*****
***
*
i)
**********
**********
**********
**********
ii)
*
**
***
****
*****
iii)
*
**
***
****
*****
iv)
*
***
*****
*******
*********
v)
1
222
33333
4444444
555555555
vi)
1
212
32123
4321234
543212345