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


Please Help Members By Posting Answers For Below Questions

What is the difference between ‘g’ and “g” in C?

2706


What do you mean by a sequential access file?

637


What is difference between structure and union with example?

605


Given an array of 1s and 0s arrange the 1s together and 0s together in a single scan of the array. Optimize the boundary conditions?

995


In the DOS enveronment, normal RAM that resides beyond the 1mb mark. a) expanded memory b) swapped memory c) Extended memory d) none

741






How can you pass an array to a function by value?

617


What are the restrictions of a modulus operator?

648


Write the control statements in C language

665


What is the difference between the expression “++a” and “a++”?

660


How many types of operator or there in c?

614


What is the Purpose of 'extern' keyword in a function declaration?

664


a program that performs some preliminary processing in C, it acts upon certain directives that will affect how the compiler does its work a) compiler b) loader c) directive d) preprocessor

653


Read the following data in two different files File A: aaaaaaaadddddddd bbbbbbbbeeeeeeee ccccccccffffffff File B: 11111111 22222222 33333333 By using the above files print the following output or write it in the Other file as follows aaaaaaaa11111111dddddddd bbbbbbbb22222222eeeeeeee cccccccc33333333ffffffffffff

2255


Write a function which takes as parameters one regular expression(only ? and * are the special characters) and a string and returns whether the string matched the regular expression.

667


What are the 4 types of unions?

621