0% found this document useful (0 votes)
8 views5 pages

Program

The document contains four C++ programs that perform basic arithmetic operations. The first program compares two numbers to find the greater one, the second checks if a number is a multiple of two, the third calculates the sum of two numbers and checks if it is greater than 100, and the fourth multiplies two numbers and determines if the result is even or odd.

Uploaded by

Ch Ashan Ahmed
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)
8 views5 pages

Program

The document contains four C++ programs that perform basic arithmetic operations. The first program compares two numbers to find the greater one, the second checks if a number is a multiple of two, the third calculates the sum of two numbers and checks if it is greater than 100, and the fourth multiplies two numbers and determines if the result is even or odd.

Uploaded by

Ch Ashan Ahmed
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/ 5

Q1: Take two number from the user and display the greater number

#include<iostream>

using namespace std;

int main()

int num1,num2;

cout<<"enter first number :\n";

cin>>num1;

cout<<"enter second num:\n";

cin>>num2;

if(num1>num2)

cout<<"the greater number is:"<<num1;

else

cout<<"the greater number is:"<<num2;

return 0;

}
Q2: Take a number from the user and tell it that multiple of two or not

#include<iostream>

using namespace std;

int main()

int num;

cout<<"enter a number:";

cin>>num;

if(num%2==0)

cout<<"the number is the multiple of2"<<endl;

else

cout<<"the number is not multiple of 2"<<endl;

return 0;

}
Q: 3 Input two number from the user tae the sum and display that sum is
greater then 100 or not
#include<iostream>

using namespace std;

int main()

int num1,num2;

cout<<"enter the first number";

cin>>num1,

cout<<"enter second number";

cin>>num2;

int sum=num1+num2;

if(sum>100)

cout<<"the sum of two number is greater than hundred";

else

cout<<"the sum of two number is less than hundred";

return 0;

}
Q:4 Input two number from the user , multiply them and tell their
answer is even or odd
#include <iostream>

using namespace std;

int main()

int num1,num2;

cout<<"enter the first number";

cin>>num1,

cout<<"enter second number";

cin>>num2;

int ans=num1*num2;

if(ans%2==0)

cout<<"the anwer is"<<ans<<"which is even";

else

cout<<"the answer is"<<ans<<"which is odd";

return 0;

You might also like