#include<stdio.h>
int main(int argc, char *argv[])
{
float j=0.0001,i;
float num=atoi(argv[1]);
if(argc!=2)
exit(1);
for(i=0;i<num;i=i+j)
{
if((i*i)>num)
break;
}
i=i-j;
printf("%.3f",i);
return 0;
int main(int argc, char *argv[])
{
float j=0.0001,i;
float num=atoi(argv[1]);
if(argc!=2)
exit(1);
for(i=0;i<num;i=i+j)
{
if((i*i)>num)
break;
}
i=i-j;
printf("%.3f",i);
return 0;
}
2 Comments
Please check this code:
ReplyDelete#include
int main(int argc, char*argv[])
{
Printf("\n enter a no.");
n=atoi(argv[1]) ;
for(i=0.01; i*i<n; i=i+0.01)
{
Printf("\n %0.02f",i);
}
}
Your code will get some errors. You can also compile it to know.
Deleteyou haven't specified datatype of i