Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Why does this program crash?

Name: Anonymous 2009-12-05 20:51

#include <stdio.h>

int main(){
   
    int i, j, num;
   
    scanf("%d", num);
    for(i=2;i<num;i++){
    j=i;
    if(num%j==0){
    printf("The number is not prime.\n");
    break;}
    else
    printf("The number is prime.\n");
}

system("pause");

return 0;
}

Name: Anonymous 2009-12-05 21:03

3. Using printf when you don't have formatting to do

is that really such a big deal?

also op:
j=i;

the hell you are doing this for?

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List