Write c-code for 5+55+555+5555+55555+555555+5555555.
Output will be it's answer...
Answer Posted / sunny
Hi Guys,
The answers above are correct but i was wondering if one has to add 5+55+555+.... till 'n'digits then??
Then the answer would be
#include<stdio.h>
#include<math.h>
void main()
{
long int res=0;
int n;
printf("The Maximum Digit(i.e. if youy want result upto 555 then enter '3'):");
scanf("%d",&n);
res= (5*pow(10,(n+1)) - 50 -(45*n))/81;
// VII standard maths
printf("%ld",res);
}
THANX
| Is This Answer Correct ? | 10 Yes | 3 No |
Post New Answer View All Answers
What is the difference between exit() and _exit() function?
How can you be sure that a program follows the ANSI C standard?
c program for searching a student details among 10 student details
What is && in c programming?
What is sizeof array?
What is the difference between declaring a variable and defining a variable?
what is the difference between class and unio?
What do header files do?
What is switch in c?
How will you write a code for accessing the length of an array without assigning it to another variable?
What is pass by reference in c?
What is function pointer c?
Dont ansi function prototypes render lint obsolete?
Why is c called c?
Explain the difference between malloc() and calloc() function?