Introducing Radical.sh

Forget Code launches a powerful code generator for building API's

Sum of digits without recursive function in C++

//SUM OF INTEGERS

#include<iostream.h>
#include<conio.h>
void main()
{

int num,sum=0;
int i,val;
clrscr();
cout<<"Enter the number of integers :";
cin>>num;
cout<<"Enter the number:";
for(i=0;i<num;i++)
{
cin>>val;
sum=sum+val;
}
cout<<"Sum of given integers:"<<sum;
getch();

}