Create a program will ask the user to enter an integer number and a string . If the integers number is odd print the string word/s that the user enter and if the integers number is even print the even number with the string word s “this is an even number”.
#include <iostream>
using namespace std;
int main() {
int n;
cout<<"\nEnter an integer: ";
cin>>n;
string str;
cout<<"\nEnter a string: ";
cin>>str;
if(n%2 !=0){
cout<<"\n"<<str;
}
else{
cout<<"\n"<<n<<" this is an even number";
}
return 0;
}
Comments
Leave a comment