/* This program takes thenatural logarithm of an input number */ #include<stdio.
ID: 3613601 • Letter: #
Question
/* This program takes thenatural logarithm of an input number */
#include<stdio.h>
#include <stdlib.h>
#include <math.h>
int main(void)
{
double n;
int i;
for(i=0;i<2;i++)
printf("Enter a number whose natural log you want to find:");
scanf("lf", &n);
if(n<=0)
{if(i==0)
Printf("Invalid entry-Only 2 attemps allowed ");
else if(i==1)
printf("I warned you-You-you incompetent--I'm out ofhere!!! ");
}
else
{
printf("The natural log of"<<n<<" is "<<log(n)<<endl);
i=2; //instead of usinga break to exit the loop
}
}
system("pause");
return 0;
}
Explanation / Answer
/* This program takes the natural logarithm of an input number*/ #include #include #include #include int main(void) { double n; int i; for(i=0;iRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.