Professional Documents
Culture Documents
Act 8
Act 8
Act 8
1. Create a program with a function to find out whether the given number is either odd or even.
#include <iostream>
int main ()
int age;
cin>>age;
if (age%2 == 0) {
cout<<"even"<<endl;
}else{
cout<<"odd"<<endl;
return 0;
2. Create a program where you will ask 2 numbers from the user and get the product of those numbers. Use a function
to solve this problem.
#include <iostream>
int main ()
cin>>a>>i;
sum=(a+i);
product=(a*i);
cout<<"\n\n";
return 0;
3. Write a program to print cumference and area of a circle of radius entered by the user by defining yout own
function.
#include <iostream>
int main ()
float r, area;
cin>>r;
area = 9*(r*r);
return 0;