#include <iostream.h>
#include<conio.h>
int main()
{
int
i,n, sum=0,even=0 ,odd=0;
int
a[20] ;
cout<<"How
many elemnt do you want:--"<<endl;
cin>>n;
for (i=0; i<n; i++)
{
cout<<"Enter the value in
array:-"<<endl;
cin>>a[i];
}
cout<<"Element
is:--"<<endl;
for
(i=0; i<n ;i++)
{
cout<<a[i]<<endl;
}
cout<<"sum
of all integer numbers:-"<<endl ;
for
(i=0; i<n ;i++)
{
sum=sum+a[i];
}
cout<<sum<<endl;
for
(i=0; i<n ;i++)
{
if(a[i]%2==0)
{
even=even+a[i];
}
else
{
odd=odd+a[i];
}
}
cout<<"sum
of all even numbers :-"<<endl ;
cout<<even<<endl;
cout<<"sum
of all odd numbers :-"<<endl ;
cout<<odd<<endl;
getch();
}
No comments:
Post a Comment