Find The Digit ODD And EVEN via Cpp programming? #include<iostream> #include<conio.h> using namespace std; int main() { int y; cout<<"Enter Num";cin>>y; if(y%2==0) cout<<"Even Num"; else { cout<<"Odd Num"; } getch (); } Output Result By Entering Odd Digit By Entering Even Digit
Calculating Name and Marks in Cpp #include<iostream> #include<conio.h> using namespace std; int main() { int x[5]; char Name[5][20]; cout<<"Enter Name ..\t"<<"Enter Marks .."<<endl<<endl; for(int i=0; i<5; i++) { cout<<" ";cin>>Name[i]; cout<<"\t \t"; cin>>x[i]; } int Max=0; Max=x[0]; int loc=0; for(int i=1; i<5; i++) { if(Max < x[i]) { Max= x[i]; loc= i; } } cout<<endl<<"Maximum Num is ..."<<Max; cout<<endl<<"Name is.. "<<Name[loc]; getch(); } Output Result
How To Create the Triangle of Characters in C++ programming Language? #include<iostream> #include<conio.h> using namespace std; int main() { int a,b,N=65; for(a=7;a>=1;a--) { for(b=0;b<a; b++) { cout<<" "; cout<<char(N); N++; } cout<<endl; } getch(); } Output Result
Comments
Post a Comment