Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Programming Lab # 4 Q: Write a program to check whether or not the input number from user is even or odd. #include<iostream> #include<conio.h> using namespace std; int main() { int num; cout<<"Enter the Number = "; cin>>num; if (num%2==0) cout<<"The Number is Even"; else cout<<"The Number is Odd"; getch(); return 0; } Q: Write a C++ program to ask again and again by user that the input number is even or odd until we enter 0 and it ends the program. #include<iostream> #include<conio.h> using namespace std; int main() { int num; cout<<"If you will enter 0, program will end\n\n"; cout<<"Enter the Numbers = "; while(num!=0) { cin>>num; if(num==0) { return 0; } else if (num%2==0) { cout<<"The number is Even"<<endl<<endl; } else if(num%2!=0) { cout<<"The number is Odd"<<endl<<endl; } } getch(); return 0; }