The placement season has begun in a college. There are N number of students standing outside an interview room in a line. It is given that a person who goes in first has higher chances of getting selected
#include<conio.h>
#include <iostream>
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#include <cmath>
#include<dos.h>
#include <bits/stdc++.h>
#include<vector>
using namespace std;
#define N 5
int main()
{
float Prob,Sum=0;
int r,n=1;
for(r=1;r<=N;r++) Sum = Sum + r;
for(r=N;r>=1;r--)
{
Prob = float(r)/Sum;
printf("\n\tProb. of Student no. %d = %.3f",n,Prob);
n++;
}
}
Comments
Leave a comment