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 print the characters by entering the value between 1 to 65 in C++ programming Language? #include<iostream> #include<conio.h> using namespace std; int main() { int r,c,E; int Num=65; cout<<"Enter The Ending Value . ";cin>>E; cout<<endl<<endl; for(r=1;r<=E;r++) { for(int i=0; i<=E-r; i++) { cout<<char(Num); Num++; } for(c=1; c<=r; c++) { cout<<"*"; } cout<<endl; } getch(); } Output Result By Entering the value of 45. By Entering the value of 10.
Comments
Post a Comment