C++ Programs
C++ Programs
int main() {
#include <bits/stdc++.h>
int main() {
puts("Anmol");
return 0;
Output
Anmol
// C++ program demonstrate how to print your
#include <bits/stdc++.h>
using namespace std;
int main() {
// Variable to store the name
string str;
// Taking the name string as input using
// cin object
cin >> str;
// Print the name string using cout object
cout << str;
return 0;
}
Input
Anmol
Output
Anmol
int main() {
int n;
if ( n % 2 == 0)
cout << n << " is even.";
else
cout << n << " is odd.";
return 0;
}
Output
Enter an integer: 23
23 is odd.
int main() {
int number;
int main() {
// prints sum
cout << first_number << " + " << second_number << " = " << sum;
return 0;
}
Output
Enter two integers: 4
5
4+5=9