memcpy
This thread is really starting to be useless, as the OP won't listen to any of our suggestions.
First off, indent your code properly. No one wants to read that jumbled mess of random whitespace and left-aligned loops. If you can't figure out how to do this, most IDEs and the GCC tool "indent" will do it for you.
I tried rearrange what do you think?
Second, listen to our ....ing suggestions. Don't use void main, use int main.
Done,
Don't put #includes after function prototypes.
Where I put it then?
Prototypes ARE NOT FUNCTION DECLARATIONS, of course you got 18 errors. We keep telling you this, and you're pasting the exact same errors over and over again.
My teacher said to me they are function declarations, so I don’t know. So I need to search about function prototype.
I really don't feel like guiding you through a homework assignment, especially if you're not gonna take any of my advice.
It is not a homework assignment.
Third, while I didn't say this, stahta01 had a point by saying that <conio.h> is outdated. Don't use it, and if your instructor tries to tell you to use it, explain why it's bad. (if you don't know, it's only usable by people with old Windows machines, and newer ones with backward compatibility).
I got a new window machine, it work. But I will delect it.
Code:
int takenum ();
void banner(void);
void error_message(int);
#include <stdlib.h>
#include <stdio.h>
int p=1;
int main()
{
int number1, number2;
int a[20],k,sum;
int i;
sum=0;
banner();
number1=takenum();
number2=takenum();
i=0;
a[i]=number1;
do{ i++;
a[i]=number1+i;
}while(a[i]<number2);
printf("The numbers are\n");
i=0;
do{printf("%d\t",a[i]);
sum=sum+a[i];
i++;
}while (a[i]<number2);
sum=sum+number2;
printf("\n\nThe sum is %d\n",sum);
}
void banner()
{
printf(" **************************************************************\n");
printf(" * *\n");
printf(" * This program add two number *\n");
printf(" * *\n");
printf(" **************************************************************\n");
}
int takenum()
{ int in1,error;
do{
printf("Enter number %d:",p);
scanf("%d",&in1);
error=in1;
error_message(error);
}while(error==0);
p=p+1;
return(in1);
}
void error_message(int error)
{
if(error==0)
{printf("\n*** Illegal character***\n");
}
}