-1
I’m trying to create a C program that shows all prime numbers from 1 to 100 using brute force, but my program shows nothing on the screen.
#include <stdio.h>
#include <stdlib.h>
int main()
{
int x=100,n=2,z=0;
int p[z];
verif:
while(x!=1)
{
while(x%n!=0)
{
if(n==(x-1))
{
z++;
p[z-1]=x;
break;
}
n++;
}
x--;
n=2;
goto verif;
}
while(z>=0)
{
printf("%d",p[z]);
z--;
}
}
Did the answer solve your question? Do you think you can accept it? See [tour] if you don’t know how you do it. This would help a lot to indicate that the solution was useful for you. You can also vote on any question or answer you find useful on the entire site (when you have 15 points).
– Maniero