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 static and volatile in c?
Write the program that calculates and prints the average of several integers. Assume that the last value read is sentinel 9999.
What is "Hungarian Notation"?
What are identifiers and keywords in c?
What is modeling?
What is a char c?
How does #define work?
How to compare array with pointer in c?
develop algorithms to add polynomials (i) in one variable
Array is an lvalue or not?
Explain how can you restore a redirected standard stream?
What is int main () in c?
Where define directive used?
How many levels of indirection in pointers can you have in a single declaration?
Explain what is wrong with this statement? Myname = ?robin?;