#include<iostream.h>
#define MAX 5
void sumIt(void);
int main()
{
int i =0;
printf("Enter 5 numbers to be summed\n");
for(i = 0; i<MAX; ++i)
sumIt();
printf("Program completed\n");
getchar();
return 0;
}
void sumIt(void)
{
int sum = 0;
int num;
printf("\nEnter a number: ");
scanf("%d", &num);
sum+=num;
printf("The current sum is: %d",sum);
}
No comments:
Post a Comment