how to find sum of 5 digits in C?

Answer Posted / rohit

#include<stdio.h>
int main()
{
int n,sum=0;
printf("enter number");
scanf("%d".&n);
for(int i=0;i<5;i++)
{
sum=sum+n;
}
printf("sum is %d",sum);
return 0;
}

Is This Answer Correct ?    2 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain argument and its types.

608


What is printf () in c?

583


What is the purpose of sprintf() function?

609


How do shell structures work?

575


The file stdio.h, what does it contain?

670






main(){char *str;scanf("%s",str);printf("%s",str); }The error in the above program is: a) Variable 'str' is not initialised b) Format control for a string is not %s c) Parameter to scanf is passed by value. It should be an address d) none

728


what is the height of tree if leaf node is at level 3. please explain

1604


What is the scope of an external variable in c?

572


Write an algorithm for implementing insertion and deletion operations in a singly linked list using arrays ?

3060


What does node * mean?

716


What are the properties of union in c?

596


What tq means in chat?

584


Explain what is wrong in this statement?

639


What is restrict keyword in c?

649


How many identifiers are there in c?

587