Вы находитесь на странице: 1из 3

#include <iostream> #include <cstdlib> #include <cmath> using namespace std; int main() { int a,b,c; a=b=c=0; cout<<"Please

enter the first number."<<endl; cin>>a; cout<<endl; cout<<"Please enter the second number."<<endl; cin>>b; cout<<endl; cout<<"Please enter the third number."<<endl; cin>>c; cout<<endl; //ODD or EVEM if ((a%2)==0) cout<<"The first number is even."<<endl; else cout<<"The first number is odd."<<endl;

if ((b%2)==0) cout<<"The second number is even."<<endl; else cout<<"The second number is odd."<<endl; if ((c%2)==0) cout<<"The third number is even."<<endl; else cout<<"The third number is odd."<<endl<<endl; cout<<endl; //Factor or not //Factor 2 if ((a%2)==0) cout<<"The else cout<<"The //Factor 3 if ((a%3)==0) cout<<"The else cout<<"The //Factor 5 if ((a%5)==0) cout<<"The else

first number is a factor of 2."<<endl; first number is not a factor of 2."<<endl; first number is a factor of 3."<<endl; first number is not a factor of 3."<<endl; first number is a factor of 5."<<endl;

cout<<"The first number is not a factor of 5."<<endl; cout<<endl; //Factor 2 if ((b%2)==0) cout<<"The else cout<<"The //Factor 3 if ((b%3)==0) cout<<"The else cout<<"The //Factor 5 if ((b%5)==0) cout<<"The else cout<<"The cout<<endl; //Factor 2 if ((c%2)==0) cout<<"The else cout<<"The //Factor 3 if ((c%3)==0) cout<<"The else cout<<"The //Factor 5 if ((c%5)==0) cout<<"The else cout<<"The cout<<endl; //Largest number if (a>b && a>c) cout<< "The first number is the larget number."; if (b>a && b>c) cout<< "The second number is the larget number."; if (c>a && c>b) cout<< "The third number is the larget number."; cout<<endl; //Smallest number if (a<b && a<c) cout<< "The first number is the smallest number."; if (b<a && b<c) cout<< "The second number is the smallest number.";

second number is a factor of 2."<<endl; second number is not a factor of 2."<<endl; second number is a factor of 3."<<endl; second number is not a factor of 3."<<endl; second number is a factor of 5."<<endl; second number is not a factor of 5."<<endl;

third number is a factor of 2."<<endl; third number is not a factor of 2."<<endl; third number is a factor of 3."<<endl; third number is not a factor of 3."<<endl; third number is a factor of 5."<<endl; third number is not a factor of 5."<<endl;

if (c<a && c<b) cout<< "The third number is the smallest number."; cout<<endl; //Average float d; d= ((a + b + c)/3); cout<< "The average is "<<d<<endl; cout<<endl; cout<<"Yeah! All done. I hope this knowledge was helpful and made your day ."<<endl<<endl; system ("PAUSE"); return 0; }

Вам также может понравиться