Solve Problems To Solve Real-World Problems
1) Write a program to display "Hello World"
2.) Add and display three numbers without using a variable.
3). Write a program, which asks the user to input a number. Then display it.
4.) Finding the average of three numbers.
5) Write a program to display the following output using a single cout statement Subject Marks Mathematics 80
Computer 77
Physics 70
6 ) Write a program, which displays the value of “π”, then inputs the radius of a circle from the user and displays its area and circumference. Note: You will have to declare a variable for “π” named as “pi” yourself and initialize it the value 22/7. Area = 𝝅𝒓 𝟐 Circumference = 2πr
7) Write a program to calculate the area and perimeter of the square.
8) Write a program to calculate the interest of the bank deposit (formula interest= amount*years*rate/100).
9) Write a program to input/get a number of float types from the user and then show this number as both floats with decimal points and integer without decimal points.
10) Write a program, which asks the user to enter two numbers, and then output them after Objectives: • Practice and understanding on basic C++ programs swapping their values using the third variable
OUTPUT-:
Enter the variable "a" = 5
Enter the variable "b" = 6
Before Swapping
Value in the variable "a" = 5
Value in the variable "b" = 6
After Swapping
Value in the variable "a" = 6
Value in the variable "b" = 5
11) Write a program to swap the value of two variables without using a third variable.
Clue: Use arithmetic operators such as division ‘/’ and multiplication * or addition + and subtraction
12) Write a program to Convert Temperature from Fahrenheit (℉) to Celsius (℃)
(formula C=5/9*(F-32))
13) Write a program to calculate the quotient and remainder. Use proper names of variables a. divisor b. dividend c. quotient d. remainder