// C++ program to find the total marks and average of three subjects INPUT: #include<iostream> using namespace std; int main() { int a,b,c,sum,avg; cout<<"\n Enter Mark 1:"; cin>>a; cout<<"\n Enter Mark 2:"; cin>>b; cout<<"\n Enter Mark 3:"; cin>>c; sum = a + b + c; avg = sum / 3; cout<<"\n The sum = "<<sum; cout<<"\n The average = "<<avg<<"%"; } 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:
Comments
Post a Comment