write a 'c' program to sum the number of integer values
Answers were Sorted based on User's Feedback
Answer / durga bhavani
void main()
{
int a[25],n,i,sum=0;
printf("enter n value");
scanf("%d",&n);
printf("\n Enter the numbers");
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
for(i=0;i<n;i++)
sum+=a[i];
printf("\nSum of the given numbers is %d",sum);
}
Is This Answer Correct ? | 39 Yes | 18 No |
Answer / chandra
#include<stdio.h>
#include<conio.h>
main()
{
int a[25],n,i,sum=0;
printf("enter n value");
scanf("%d",&n);
printf("\n Enter the numbers");
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
for(i=0;i<n;i++)
sum+=a[i];
printf("\nSum of the given numbers is %d",sum);
}
Is This Answer Correct ? | 11 Yes | 5 No |
Answer / prince rafi
void main()
{
int sum,a=6,b=3;
clrscr();
sum=a+b;
printf("%d",sum);
}
getch();
}
Is This Answer Correct ? | 3 Yes | 0 No |
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
clrscr();
printf("Enter a integer no:-"); scanf("%d",&a);
printf("Enter a Integer no:-"); scanf("%d",&b);
printf("Sum= %d",a+b);
getch();
}
Is This Answer Correct ? | 13 Yes | 12 No |
Answer / arunkumar
#include<stdio.h>
#include<conio.h>
fun(int n);
int main()
{
int n=10;
printf("%d",fun(10));
}
fun(int n)
{
if(n<1)
return n;
else
return (n+fun(n-1));
}
Is This Answer Correct ? | 5 Yes | 7 No |
Answer / neha shree
void main()
{
int a,n,i,sum=0;
printf("enter n value");
scanf("%d",&n);
printf("\n Enter the numbers");
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
for(i=0;i<n;i++)
sum+=a[i];
printf("\nSum of the given numbers is %d",sum);
}
Is This Answer Correct ? | 9 Yes | 12 No |
Answer / vignesh1988i
here the program uses dynamic memory allocation concept instead of arraya......
#include<stdio.h>
#include<conio.h>
void main()
{
int *pointer,n,sum=0;
clrscr();
printf("enter no. of elements :");
scanf("%d",&n);
pointer=(int*)malloc(n*sizeof(int));
for(int i=0;i<n;i++)
{
scanf("%d",(pointer+i));
sum=sum+(*(pointer+i));
}
printf("the sum is :%d",sum);
getch();
}
thank u
Is This Answer Correct ? | 11 Yes | 17 No |
Answer / ruchi
#include<stdio.h>
#include<conio.h>
int main()
{
int n,m,m1,s=0,d,sum;
printf("\nEnter the number ");
scanf("%d",&n);
m=n%10;
d=n/10;
while(d>=10)
{
m1=d%10;
d=d/10;
s =s+m1;
}
sum=s+m+d;
printf("\nSum is %d",sum);
getch();
}
Is This Answer Correct ? | 4 Yes | 15 No |
Result of the following program is main() { int i=0; for(i=0;i<20;i++) { switch(i) case 0:i+=5; case 1:i+=2; case 5:i+=5; default i+=4; break;} printf("%d,",i); } } a)0,5,9,13,17 b)5,9,13,17 c)12,17,22 d)16,21 e)syntax error
what is the benefit of c30
Hai sir, I had planned to write the NIC scientific engineer exam , plz post the sample question......
what is the syallabus of computer science students in group- 1?
You have an array of n integers, randomly ordered with value 1 to n-1.The array is such that there is only one and one value occurred twice. How will you find this number?
the output will be #include<stdio.h> int main () { int i; i = 9/2; printf("%i",i); return 0; }
what is call by value and call by reference
main() { printf(5+"good morning"); printf("%c","abcdefgh"[4]); }the o/p is morning and e...how someone explain
what is ram?
How can I change their mode to binary?
What is selection sort in c?
What is the meaning of typedef struct in c?