In odd/even question if we provide very large value (like up to 12 digits ) then there are error in program;
#include<iostream>
using namespace std;
int main(){
cout<<"This program is for finding if the provided integer is even or odd.\nPls provide the integer...\n";
int a;
cin>>a;
if(a%2==0){
cout<<"The provided integer is even.";
}
else{
cout<<"The provided integer is odd.";
}
return 0;
}
>Solution :
Hi the maximum value int can take in C++ is 2,147,483,647 , So 12 digits can’t be handled by int , Use long int insted