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
How will you divide two numbers in a MACRO?
What is the total generic pointer type?
What are the restrictions of a modulus operator?
What is the scope of global variable in c?
What is the data segment that is followed by c?
What are the advantages of using macro in c language?
What is a c token and types of c tokens?
What is pointer to pointer in c?
What is data structure in c programming?
writ a program to compare using strcmp VIVA and viva with its output.
Explain how can a program be made to print the name of a source file where an error occurs?
How many main () function we can have in a project?
Describe the order of precedence with regards to operators in C.
How does sizeof know array size?
What is register variable in c language?