1// Your First C++ Program
2
3#include <iostream>
4
5int main() {
6 std::cout << "Hello World!";
7 return 0;
8}
9
1#include <iostream>
2#include<conio.h> /* For getch() only */
3using namespace std;
4int main () {
5 int num = 10;
6 if (num % 2 == 0)
7 {
8 cout<<"It is an even number";
9 }
10getch(); /* getch is the function of conio.h */
11}
1#include<bits/stdc++.h>
2using namespace std;
3int
4main ()
5{
6 string s1, s2;
7 cin >> s1 >> s2;
8 cout << s1.size () << " " << s2.size () << endl;
9 cout << s1 << s2 << endl;
10 char temp;
11 temp = s1[0];
12 s1[0] = s2[0];
13 s2[0] = temp;
14 cout << s1 << " " << s2 << endl;
15}
1#include <bits/stdc++.h>
2using namespace std;
3
4long int getSumOfFactors(int n)
5{
6 long int temp = 0;
7 for (int i=1;i<=n;i++){
8 if (n%i==0) temp = temp+i;
9 }
10 return temp;
11}
12
13int main()
14{
15 int n;
16
17 cout<<"Input the number : ";
18 cin>>n;
19
20 long int result = getSumOfFactors(n);
21
22 cout<<"\nThe Summation of the all the factors of the number is : "<<result;
23
24}