Vous êtes sur la page 1sur 1

write a program that takes input from user 10 time and passes each

value to the function to calculate sum of all values


============================================
#include<iostream.h>
#include<conio.h>

int sum(int,int);

void main(){
clrscr();
int result=0,num;
for(int i=1;i<=10;i++){
cout<<"\n Enter A number: ";
cin>>num;
result=sum(num,result);
}
cout<<"\n The sum of all values is: "<<result;
getch();
}

int sum(int current,int old){


return current+old;
}

http://www.ravianeducation.blogspot.com
FARHAN: 03008855006