Write a program to enter 10 number of integer entries into
an array n and then odds up all the odd entries. the program
then displays the result.
plssss answer assss fast asss u can...



Write a program to enter 10 number of integer entries into an array n and then odds up all the odd ..

Answer / avk

I didn't mention in which programing Language U need this so
I wrote in 'C'. I hope U will understand

#include<stdio.h>
#include<conio.h>
void main()
{
int n[i],i,sum=0;
clrscr();
for(i=0;i<10;i++)
{
scanf("%d",&n[i]);
if(n[i]%2==0)
continue;
else
sum+=n[i];
}
printf("Total Of Odd Numbers %d",sum);
getch();
}

Is This Answer Correct ?    32 Yes 19 No

Post New Answer

More C++ Code Interview Questions

can we declare an object of a class in another class?(assume both class as public classes)

1 Answers   Microsoft,


1. Write a program using one dimensional array that calculates the sum and average of the five input values from the keyboard and prints the calculated sum and average.

2 Answers  


program to find the magic square using array

1 Answers  


main(){int a=5,b 10,c=2, d;a=b c;d=++a=(--c)*2; printf("%d%d%d%d,a,b,c,d; return o;}

1 Answers  


An array of size 5X5 is given to us. The elements from 1 to 25 are to be inserted in the array, such that starting from a particular position for an element i, the next element i+1can be inserted only at the mentioned positions (u,v), and if these all positions are occupied then it returns giving a count of how many positions have been occupied in the array: (u,v) = (x+/-3 , y) (u,v) = (x , y+/-3) (u,v) = (x+/-2 , y+/-2). Example: if the starting element is 1 with the given positions (1,2), then next element 2 can be placed at any one of the positions marked with *. _ _ _ _ _ 1 _ _ _ * _ _ _ _ _ _ _ * _ _ * _ _ _ _

0 Answers   Nagarro,






void main() { int i,j=2; for(i=0;i<3;i++) if(j=i) cout<<"Lotus "; else cout<<"Rose "; } Its result is Rose Lotus Lotus.. How? Explain it?

2 Answers  


create a stucture student containing field for roll no,class,year and marks.create 10 student annd store them in a file

0 Answers   HCL,


write a program that can locate elements in array.

1 Answers  


Faster Computers Suppose you have a computer that requires 1 minute to solve problem instances of size 1000. What instance sizes can be run in 1 minute if you buy a new computer that runs 1000 times faster than the old one, assuming the following time complexities T(n) for our algorithm? (a) T(n) = O(n). (b) T(n) = O(n3). (c) T(n) = O(10n).

1 Answers   Qatar University,


How to Split Strings with Regex in Managed C++ Applications?

0 Answers   Microsoft,


Subsets Write an algorithm that prints out all the subsets of 3 elements of a set of n elements. The elements of the set are stored in a list that is the input to the algorithm. (Since it is a set, you may assume all elements in the list are distinct.)

1 Answers   CSC, Qatar University,


Write an algorithm that receives a string and reverses it.

2 Answers  


Categories