I need help with this problem. The only thing I have done is to input the numbers less than 0. Any ideas?
Write a program. In main create a DO loop. In the loop ask the user to enter a number. If the number is positive call a function. If the number is negative end the program. In the function keep track of how many times the function has been called and each time in the function print the number of times you have called the number on a new line. Pass no values to the function. DO NOT USE GLOBAL VARIABLES THIS TIME
So far, I only have this code:
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
void counter(void);
int main()
{
int number;
do
{
printf("\nEnter a number: ");
scanf("%d", &number);
if(number >= 0)
{
//counter();
}
}while(number >= 0);
printf("\nPress any key to continue...");
getch();
return 0;
}
void counter(void)
{
//counter code`enter code here`
enter code here
}