Skip to main content

Posts

Showing posts with the label CPP

For Loop Hackerrank Solution CPP

 For Loop Hackerrank Solution CPP For Explanation Watch Video: Sample Input 8 11 Sample Output eight nine even odd Code: #include   < iostream > #include   < cstdio > using   namespace  std; int  main() {      // Complete the code.      int a,b;     cin>>a>>b;     for(int n=a;n<=b;n++){         if(n<=9){             if(n==1){                 cout<<"one"<<endl;             }else if(n==2){              cout<<"two"<<endl;             }e...

Conditional Statements Hackerrank Solution CPP

 Conditional Statements Hackerrank Solution CPP For Explanation Watch Video: Sample Input 0 5 Sample Output 0 five Explanation 0 five  is the English word for the number  . Sample Input 1 8 Sample Output 1 eight Explanation 1 eight  is the English word for the number  . Sample Input 2 44 Sample Output 2 Greater than 9 Code: #include   < bits/stdc++.h > using   namespace  std; int  main() {      int  n;     cin >> n;     cin.ignore(numeric_limits<streamsize>::max(),  '\n' );      if(n==1){         cout<<"one";     }else if(n==2){         cout<<"two";     }else if(n==3){         cout<<"three";     }else if (n=...

Basic Data Types Hackerrank Solution CPP

 Basic Data Types Hackerrank Solution CPP For Explanation Watch Video: Sample Input 3 12345678912345 a 334.23 14049.30493 Sample Output 3 12345678912345 a 334.230 14049.304930000 Code: #include   < iostream > #include   < cstdio > using   namespace  std; int  main() {     int a;     long b;     char c;     float d;     double e;     scanf("%d %ld %c %f %lf",&a,&b,&c,&d,&e);     printf("%d\n%ld\n%c\n%.3f\n%.9lf",a,b,c,d,e);      return   0 ; }

Input and Output Hackerrank Solution CPP

 Input and Output Hackerrank Solution CPP  If You want Explanation Watch Video: Sample Input 1 2 7 Sample Output 10 Code: #include   < cmath > #include   < cstdio > #include   < vector > #include   < iostream > #include   < algorithm > using   namespace  std; int  main() {      int a,b,c;     cin>>a>>b>>c;     int sum = 0;     sum = sum + a+ b+c;     cout<<sum;      return   0 ; }

Say "Hello, World!" With C++ Hackerrank Solution

 Say "Hello, World!" With C++ Hackerrank Solution For Explanation Watch Video: Code: #include   < iostream > #include   < cstdio > using   namespace  std; int  main() {     printf( "Hello, World!" );      return   0 ; }