Saturday, 25 March 2017

Hacker Rank Solution Program In C++ For " Day 1: Data Types "

Problem :- Day 1: Data Types

Submit Your Solution Here :- Click Here

Copy The Color Code and paste it into hackerrank Editor .

Solution :-

#include <iostream>
#include <iomanip>
#include <limits>

using namespace std;

int main() {
    int i = 4;
    double d = 4.0;
    string s = "HackerRank ";

    int j;
    double e;
    string t;
    cin>>j;
    cin>>e;
    cin.ignore();  
    getline(cin,t);
    cout<<i+j<<endl;
    d=d+e;
    cout<<fixed<<setprecision(1)<<d<<endl;
    cout<<s<<t;

    return 0;
}

Output :-


Hacker Rank Solution Program In C++ For " Day 1: Data Types "

2 comments:
Write comments

Recommended Posts × +