Madhav Institute of Technology and Science
Gwalior (M.P.)
Department of Information and Technology
Submitted by: Submitted to:
Name: Shubh Gupta Dr. Sanjeev Sharma
Enrollment No.: 0901IO231065 Prof. Surbhi Gupta Branch: Internet of Things (IoT)
Semester: 1
stSubmission No.
PROGRAM 1
Objective: Write a program to add two numbers and display its sum.
Compiler: gcc (version 6.3.0)
Flowchart:
main()
Input 1st no. Input 2nd no.
Add (+)
Display the sum
using namespace std;
int main() {
double x, y;
cout << "Enter 1st no.: ";
cin >> x;
cout << "Enter 2nd no.: ";
cin >> y;
double sum = x + y;
cout << "The sum of " << x << " and " << y << " is " << sum << ".\n";
}
Output:
PROGRAM 2
Objective: Write a program to calculate and display the volume of a cylinder for height and radius parameters to be input from the user.
Compiler: gcc (6.3.0)
Flowchart:
Input height Input radius
Volume = 3.14 x radius
2x height
Display the volume
main()
using namespace std;
int main() {
double h, r;
cout << "Enter the height of the cylinder: ";
cin >> h;
cout << "Enter the radius of the cylinder: ";
cin >> r;
double vol = 3.14 * (r*r) * h;
cout << "The volume of the given cylinder is " << vol << ".\n";
}
Output: