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;