Who wants to be a Millionaire?-Hackerearth


C++14 Solution


#include <iostream>
#include <stdio.h>
using namespace std;
int main() {
 int test;
 cin >> test;
 while (test--) {
    int n;
    cin >> n;
    printf ("%.6f\n", (float)(n-1)*1.0/(float)(n));
 }
    return 0;
}


Try this on Hackerearth 


For more Hackerearth Problems

Comments

Popular posts from this blog

Balanced Binary Tree

First Unique Character in a String

Majority Element

Smallest Range II