#include<iostream>
using namespace std;
int show_array(int arr[],int size,int *ptreven,int *ptrodd)
{
for(int j=0;j<size;j++)
{
if(arr[j]%2==0)
*ptreven=*ptreven+arr[j];
else
*ptrodd=*ptrodd+arr[j];
}
return (*ptreven+*ptrodd);
}
int main()
{
//variables
int const SIZE=10;
int arr[SIZE];
int sumeven=0,sumodd=0,totalsum=0;
//Calling
for(int i=0;i<SIZE;i++)
{
cout<<"Enter number At "<<i<<" index :";
cin>>arr[i];
}
totalsum=show_array(arr,SIZE,&sumeven,&sumodd);
cout<<"Sum of even elements in array :"<<sumeven<<endl;
cout<<"Sum of odd elements in array :"<<sumodd<<endl;
cout<<"Sum of All elements in array :"<<totalsum<<endl;
return 0;
}
This Blog contains the information of computer programming and internet. All the questions are related to our course subjects of BSCS. Hopefully, this blog will evaluate your problems related to your study and will be a great platform for learning basic computer skills and techniques...and your comments will tell us how this blog serving you...!!
Friday, 27 January 2012
Arrays in the form of different Parameters
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment