I barely know what I\'m doing, I have this code where I try to solve some simple math:
#include
#include
#include
Corrected code (fixes as pointed out in the comments):
#include
//#include // You don't use anything from these headers (yet?)
//#include
//main()
int main() // main has to be defiend as an int function
{
int n, sum = 0;
printf("ENTER NUMBER:");
// scanf("%i", n);
scanf("%i", &n); // scanf need the ADDRRESS of variables
while (n > 0)
{
sum += n;
n--;
}
// printf("\n sum is:", sum);
printf("\n sum is: %i", sum); // printf needs a format specifier for each variable
return 0;
}