Friday, 1 January 2016

Day 1: Data Types! Hacker Rank Problem Solution.

Problem Statement
Welcome to Day 1! Check out the video tutorial here, or just jump right into the problem.
Let's talk about data types. In programming, a data type is a classification of types of data that determine the possible values and operations on that particular type.
Some typical examples of data types are:
  • int
  • double
  • boolean
  • char
  • String
  • Array
Remember, in languages like Java data types (like the ones above) can be classified into two main groups:
  1. Primitive Types
  2. Reference Types
For this challenge, consider the following inputs (you don't need to read any input):
  • 5.35
  • 'a'
  • false
  • 100
  • "I am a code monkey"
  • true
  • 17.3
  • 'c'
  • "derp"
For each line above, print out if it is an instance of a primitive or referenced type as well as which data type it is.
Good luck!
Hint: In Java, String is a referenced type.
Output Format
Output nine lines. Print one line for each of the input given above in the following format:
MainDataTypeOfInstance : SpecificDataTypeOfInstance
For example, if the input is:
Your output should be:
Primitive : int
Make sure you spell everything correctly and capitalize your entries. Also, don't forget spacesand colon in between the main and specific data types!


#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
    * Prosen Ghosh
    * American International University - Bangladesh (AIUB)
int main() {

    cout << "Primitive : double" << endl;
    cout << "Primitive : char" << endl;
    cout << "Primitive : boolean" << endl;
    cout << "Primitive : int" << endl;
    cout << "Referenced : String" << endl;
    cout << "Primitive : boolean" << endl;
    cout << "Primitive : double" << endl;
    cout << "Primitive : char" << endl;
    cout << "Referenced : String" << endl;
    return 0;


  1. Programming is very interesting and creative thing if you do it with love. Your blog code helps a lot to beginners to learn programming from basic to advance level. I really love this blog because I learn a lot from here and this process is still continuing.
    Love from Pro Programmer

  2. Nice article! One may also like to visit here for Guide to OOP