how to find sum of 5 digits in C?
Answers were Sorted based on User's Feedback
Answer / guest
#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%10);
n=n/10;
}
printf("sum is %d",sum);
return 0;
}
Is This Answer Correct ? | 16 Yes | 2 No |
Answer / deepshree sinha
#include<stdio.h>
#include,conio.h>
void main()
{
int i,a[6],s=0;
printf("enter the values");
for(i=0;i<5;i++)
{
scanf("%d ",7a[i]);
s=s+a[i];
}
printf("sum of five digits=%d',s);
getch();
}
Is This Answer Correct ? | 2 Yes | 1 No |
Answer / 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 |
What is a far pointer in c?
typedef struct{ char *; nodeptr next; } * nodeptr ; What does nodeptr stand for?
difference between function & structure
consagous technology placement paper
in C-programming language without using printf statement can we get output r not ? if yes how and if no also how ?
11. Look at the Code: #include<string.h> void main() { char s1[]="abcd"; char s2[10]; char s3[]="efgh"; int i; clrscr(); i=strcmp(strcat(s3,ctrcpy(s2,s1))strcat(s3,"abcd")); printf("%d",i); } What will be the output? A)No output B) A Non Integer C)0 D) Garbage
WHICH TYPE OF JOBS WE GET BY WRITING GROUPS .WHEN THE EXAMS CONDUCTED IS THIS EXAMS ARE CONDUCTED EVERY YEAR OR NOT.PLS TELL ME THE ANSWER
Distinguish between actual and formal arguments.
Why n++ execute faster than n+1 ?
main() { int x=5; printf("%d %d %d\n",x,x<<2,x>>2); }
11 Answers CISOC, CitiGroup, College School Exams Tests,
what is computer
who is the father of c