create a c++ program that will ask 10 numbers and display
their sum using array.



create a c++ program that will ask 10 numbers and display their sum using array. ..

Answer / sneha shahade

#include<conio.h>
#include<iostream.h>
void main()
{
int a[10],i,s=0;
cout<<"enter 10 numbers";
for(i=0;i<10;i++)//loop to get 10 no. in array
cin>>a[i];
for(i=0;i<10;i++)//loop to find sum of 10 no.
s=s+a[i];
cout<<"sum is:"<<s;//display sum
getch();
}

Is This Answer Correct ?    9 Yes 0 No

Post New Answer

More OOPS Interview Questions

is java purely oop Language?

49 Answers   HCL, Infosys, TCS,


What do we mean by a hidden argument in a function?

1 Answers   TCL,


What is data binding in oops?

0 Answers  


What are the access specifiers avaible in c++?

4 Answers  


string is a class or data type in java?

3 Answers  






#include <string.h> #include <stdio.h> #include <stdlib.h> #include <conio.h> void select(char *items, int count); int main(void) { char s[255]; printf("Enter a string:"); gets(s); select(s, strlen(s)); printf("The sorted string is: %s.\n", s); getch(); return 0; } void select(char *items, int count) { register int a, b, c; int exchange; char t; for(a = 0; a < count-1; ++a) { exchange = 0; c = a; t = items[ a ]; for(b = a + 1; b < count; ++b) { if(items[ b ] < t) { c = b; t = items[ b ]; exchange = 1; } } if(exchange) { items[ c ] = items[ a ]; items[ a ] = t; } } } design an algorithm for Selection Sort

0 Answers  


Why many objects can working together? How objects working togetherM I want to see example code.

2 Answers  


what is oops

4 Answers   DELL,


What is a function in oop?

0 Answers  


just right the logic of it 1--> If few people are electing then every time ur candidate should win 2--> arrange books in box, if box carry weight == books weight then take another box..... find the no of box required.

0 Answers  


what is oppes

2 Answers  


DIFFRENCE BETWEEN STRUCTURED PROGRAMING AND OBJCET ORIENTED PROGRAMING.

5 Answers  


Categories