Why this code gives runtime error

#include < stdio.h >
void main()
int i = 0;
int T;
int N;
printf(“Enter the ‘T’ value : “);
for(i = 0;i<T;i++)
printf(“Enter the ‘N’ value”);
int number = 1;
int temp;
int j = 0;
printf(“Enter values :”);
number = temp *number;
j = 1;
int count = 0;
for(j = 2;j < number;j++)
if(number%j == 0)
if(number > 1)
printf(“count = %d\n”,(count+2));
else if(number == 1)
printf(“count = 1\n”);
printf(“count = 0\n”);

not able to indent. Please use code tag and upload again with proper indentation :slight_smile:

1 Like

Please give the ideone link!!That would be easier to read!!Or while posting code indent it!!

U are using void main it causes issues. Use int main with return 0 in the end.
Also dont prompt user for input, U will get a wrong ans error if u do so.

You are getting a runtime error because, the very first line of your code is wrong. When you are using #include, you are expected to give the name (or path) of a header file within the angle brackets – no space, no extra characters. Change it to #include <stdio.h> or #include<stdio.h> (see, no spaces between < and >).

Now, you might again get a runtime error (probably and more specifically, an NZEC - Non-Zero-Exit-Code - error) because, you main does not return 0. A successfully completed C/C++ program is expected to return 0 (EXIT_SUCCESS) from the main (or from wherever the program terminates).

Try changing your void main() to int main().

Also, a few words of caution: you might still not get an accepted solution, if the output your code produces is not STRICTLY as per what the problem asks you to print. So, if the program does not ask you to output “Enter the 'N' value”, then you shall not output the same. The program will be judged wrong answer for that.