# Answer to Question #8912 in C++ for layla

Question #8912

write c++ program to find the summation of odd numbers in 2D-array

Expert's answer

#include

"stdafx.h"

#include<iostream>

#include<conio.h>

using

namespace std;

int _tmain(int argc, _TCHAR* argv[])

{

int

numbers[100];

int n=0;

cout<<"Enter the size of array :

";

cin>>n;

for(int i=0;i<n;i++){

cout<<"Enter

element number "<<(i+1)<<": ";

cin>>numbers[i];

}

int

sum=0;

for(int

i=0;i<n;i++){

if(numbers[i]%2!=0){

sum+=numbers[i];

}

}

cout<<"\nThe

summation of odd numbers is: "<<sum;

getch();

return 0;

}

"stdafx.h"

#include<iostream>

#include<conio.h>

using

namespace std;

int _tmain(int argc, _TCHAR* argv[])

{

int

numbers[100];

int n=0;

cout<<"Enter the size of array :

";

cin>>n;

for(int i=0;i<n;i++){

cout<<"Enter

element number "<<(i+1)<<": ";

cin>>numbers[i];

}

int

sum=0;

for(int

i=0;i<n;i++){

if(numbers[i]%2!=0){

sum+=numbers[i];

}

}

cout<<"\nThe

summation of odd numbers is: "<<sum;

getch();

return 0;

}

Need a fast expert's response?

Submit orderand get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

## Comments

## Leave a comment