[go: up one dir, main page]

0% found this document useful (0 votes)
33 views3 pages

#Include Using Namespace STD

This C++ program defines a function called swapTwo that takes three integer references as parameters and swaps their values. It then calls this function in main, passing three integer variables and printing their values before and after the swap.

Uploaded by

hiwot kebede
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)
33 views3 pages

#Include Using Namespace STD

This C++ program defines a function called swapTwo that takes three integer references as parameters and swaps their values. It then calls this function in main, passing three integer variables and printing their values before and after the swap.

Uploaded by

hiwot kebede
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/ 3

#include <iostream>

using namespace std;

// Assign c's value to a, a's value to b and

// b's value to c.

void swapTwo(int &a, int &b, int &c)

c = a;

a = b;

b = c;

int main()

int a = 5, b = 7,c;
cout << "Before swapping a = " << a << ", b = "

<< b << ", c = " << c << endl;

swapTwo(a, b,c);

cout << "After swapping a = " << a << ", b = "

<< b << ", c = " << c << endl;

return 0;

#include <iostream>

int main()

float radius, area;

std::cout << "Enter the radius of circle : ";

std::cin >> radius;

area = 3.14 * radius * radius;

std::cout << "Area of circle with radius "

<< radius << " is " << area;

return 0;

}
#include <iostream>

int main()

float E,m,c;

int res;

std::cout << "Enter the value of m : ";

std::cin >> m;

c=3000;

res=sqrt(c);

E=m*res;

std::cout << "Energy is E: "<< E;

return 0;

You might also like