//C++ program to print numbers from 1 to 10 INPUT: #include<iostream> using namespace std; int main() { int i; for(i=1;i<=10;i++) { cout<<i<<endl; } return 0; } OUTPUT:
// C++ program to check if a year is leap year or not INPUT: #include<iostream> using namespace std; int main() { int z; cout<<"Enter a year:"; cin>>z; if(z%4==0){ if(z%100==0){ if(z%400==0) cout<<"\n\t"<<z<<" is a leap year"; else cout<<"\n\t"<<z<<" is not a leap year"; } else cout<<"\n\t"<<z<<" is a leap year"; } else cout<<"\n\t"<<z<<" is not a leap year"; return 0; } OUTPUT:
// C++ program to multiply two numbers INPUT: #include<iostream> using namespace std; int main() { float a,b,c; cout<<"\n Enter a first value : "; cin>>a; cout<<"\n Enter a second value : "; cin>>b; c = a * b; cout<<"\n"<<" Product = "<<c<<endl; return 0; } OUTPUT:
Comments
Post a Comment