Maths fun.......

aiswariya 0 Tallied Votes 95 Views Share

This is very very simple c code.. it has simple maths logic involved..

#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
#include<time.h>
void main()
{
int i;
char c;

randomize();
i=random(99);

if(!(i%2==0))
i++;

printf("\nHi this is a game.... think of a no.. and multiply it with 2.. when ready press enter...\n");
c=getch();

printf("\nNow add it with %d..when ready press enter..\n",i);
c=getch();

printf("\nNow divide the result with 2.. press enter when ready..\n");
c=getch();

printf("\nSubtract the  got result from the original no that you thought.. press enter when you are ready...\n");
c=getch();

printf("\n\t\t The answer that you got is.... %d\n\n",i/2);
getch();

clrscr();
}