Monday, 21 July 2014

Reverse coding

Hi friends...
lets crack some codes..
Following are some sample inputs and outputs.Find the logic and make the code
sample:

































try it yourself
here is the answer:
#include<iostream.h>
#include<conio.h>
#include<math.h>
void main()
{
start:
long int input,i;
long  mul=1;
long double result;
cout<<"\nEnter a positive number:";
cin>>input;
for(i=1;i<=input;i++)
{
mul=mul*input;
}
result=2.303*log10(mul);
cout<<result;
goto start;
}

0 comments:

Post a Comment