Hands
on practice:
•
Type the following C++ Programs in Dev
C++ IDE and execute. if compiler shows any errors, try to rectify it and
execute again and again till you get the expected result.
#include <iostream>
using namespace std;
int main()
{
int m1, m2, m3, sum;
cout <<
"\n Enter Mark 1: ";
cin >> m1;
cout <<
"\n Enter Mark 2: ";
cin >> m2;
cout <<
"\n Enter Mark 3: ";
cin >> m3;
sum = m1 + m2 + m3;
cout <<
"\n The sum = " << sum;
}
Make changes in the above code to get the average of all the
given marks.
#include <iostream>
using namespace std;
int main()
{
int radius;
float area;
cout <<
"\n Enter Radius: ";
cin >> radius;
area = 3.14 * radius
* radius;
cout <<
"\n The area of circle = " << area;
}
#include <iostream>
Using namespace std;
int main( )
{
cout << “Enter a value ”;
cin << num1 >> num2
num+num2=sum;
cout >> “\n The
Sum= ” >> sum;
}
#include <iostream>
using namespace std;
int main()
{
int h=10; w=12;
cout <<
"Area of rectangle " << h+w;
}
Related Topics
Privacy Policy, Terms and Conditions, DMCA Policy and Compliant
Copyright © 2018-2026 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.