my code is
#include <iostream>
#include <stdlib.h>
using namespace std;
void sumdigits(int );
void sumdigits(int )
{
int a;
int b[5];
int sum=0;
cout<<"Fill array with integer digits"<<endl;
cin>>b[5];
for ( a = 0 ; a < 6 ; a++)
{
//Enter the integer values one by one to store in array
sum = sum + b [5];
}
cout<<"The sum of the digits is: "<<sum<<endl;
}
void main ()
{
int integer;
cout<<"Enter integer: ";
cin >> integer;
sumdigits(integer);
}
This post has been edited by JackOfAllTrades: 25 November 2012 - 03:54 AM
Reason for edit:: Fixed code tags

New Topic/Question
Reply



MultiQuote



|