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 does c in a circle mean?
Explain what does it mean when a pointer is used in an if statement?
Explain what are the standard predefined macros?
What is meant by keywords in c?
What is meant by type specifiers?
What does the file stdio.h contain?
What are data types in c language?
How can type-insensitive macros be created?
Can a program have two main functions?
Declare the structure which contains the following members and write in C list of all students who score more than 75 marks. Roll No, Name, Father Name, Age, City, Marks.
Explain what is a pragma?
Explain what are reserved words?
How can you access memory located at a certain address?
why use functions a) writing functions avoids rewriting the same code over and over b) using functions it becomes easier to write programs and keep track of what they are doing c) a & b d) none of the above
stripos — Find position of first occurrence of a case- insensitive string int stripos ( char* haystack, char* needle, int offset ) Returns the numeric position of the first occurrence of needle in the haystack string. Note that the needle may be a string of one or more characters. If needle is not found, stripos() will return -1. The function should not make use of any C library function calls.