0% found this document useful (0 votes)
69 views1 page

Practice Programs

The document provides hints and prompts for 13 simple C/C++ programs: 1) Calculate the average of 5 integers input by the user. 2) Calculate a paid amount after a discount is applied to an input amount. 3) Perform arithmetic operations (+,-,*, /, %) on two input values. 4) Convert an input value between meters, inches, and centimeters. 5) Convert an input size in GB to bytes. 6) Calculate the area and perimeter of a rectangle given width and length. 7) Convert between Fahrenheit and centigrade temperatures. 8) Display the next character after an input character. 9) Swap the values of two variables with or

Uploaded by

Adnan Rai
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
69 views1 page

Practice Programs

The document provides hints and prompts for 13 simple C/C++ programs: 1) Calculate the average of 5 integers input by the user. 2) Calculate a paid amount after a discount is applied to an input amount. 3) Perform arithmetic operations (+,-,*, /, %) on two input values. 4) Convert an input value between meters, inches, and centimeters. 5) Convert an input size in GB to bytes. 6) Calculate the area and perimeter of a rectangle given width and length. 7) Convert between Fahrenheit and centigrade temperatures. 8) Display the next character after an input character. 9) Swap the values of two variables with or

Uploaded by

Adnan Rai
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Simple C\C++ Programs

Q1. Write a program that asks the user to type 5 integers and writes the average of the
5 integers.
Q2. Write a program that asks the user to accept amount and discount from the user
then display the payed amount.
HINT:
dis_amonut= (discont/100)*amount
Q3. Accept two entry and then display arithmetic operation (+,-,*, /, %).
Q4. Accept the values in meter then display in inches and centimeters.
HINT:
1m = 39.370079 inches
1 meter (m) = 100 centimeters (cm)
Q5. Accept the values in GB and display the value in bytes.
HINT:
1 GB=1024*1024*1024 bytes
Q6. Write a program that asks the user to type the width and the length of a rectangle
and then outputs to the screen the area and the perimeter of that rectangle
HINT:
area=width*length
perimeter=2*(width+length)
Q7. Write a program which accept temperature in Fahrenheit and print it in centigrade
HINT:
5*(F-32)/9
Q8. Write a program which accepts a character and display its next character.
Q9. Write a program to swap the values of two variables
Q10. Write a program to swap value of two variables without using third variable
Q11. What is the output of following program?
int result = 4 + 5 * 6 + 2;
cout<<result;
int a = 5 + 7 % 2;
cout<<a;
Q12. 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.
Q13. Accept 5 digits no from the user then display following option.
No=12345
Result =15

You might also like