I am using a function to print numbers from 1 to N in C.But problem is that,the variables must be defined internally and there should be no use of loops.The function is being called by name.In short, function should print a digit each time it is called. I am unable to code the program since the variable is declared inside the function. Please tell me that is it possible to do so.
For exmple:To print numbers from 1 to 5. but it is printing only '1' 5 times.
#include <stdio.h>
void main()
{
repeat_function();
repeat_function();
repeat_function();
repeat_function();
repeat_function();
return 0;
}
void repeat_function()
{
int a=1;
printf (%d,a);
a = a + 1;
}