Variable - Integer and String
#include <iostream>
#include <string>
using namespace std;
int main(){
int num,len;
string str;
cout<<"Enter the Value";
cin>>num;
cout<<"Enter the Character";
cin>>str;
cout<<"\n" << num <<"\n"<< str;
}
Leap Year
#include <iostream>
using namespace std;
int main(){
int num;
cout << "Enter a year";
cin >> num;
if((num % 4) == 0 || (num % 100)==0 || (num%400) ==0 ){
cout <<num <<"is a Leap year";
}
else{
cout <<num <<"is not a Leap year";
}
return 0;
}
#include <iostream>
#include <string>
using namespace std;
int main(){
int num,len;
string str;
cout<<"Enter the Value";
cin>>num;
cout<<"Enter the Character";
cin>>str;
cout<<"\n" << num <<"\n"<< str;
}
Leap Year
#include <iostream>
using namespace std;
int main(){
int num;
cout << "Enter a year";
cin >> num;
if((num % 4) == 0 || (num % 100)==0 || (num%400) ==0 ){
cout <<num <<"is a Leap year";
}
else{
cout <<num <<"is not a Leap year";
}
return 0;
}
No comments:
Post a Comment