计算素数的程序,能否不使用goto语句而得到更简练的程序?该如何处理

计算素数的程序,能否不使用goto语句而得到更简练的程序?C/C++ code#includemath.h#includestdio.hmain

计算素数的程序,能否不使用goto语句而得到更简练的程序?

C/C++ code
#include<math.h>#include<stdio.h>main(){    int i,j;    for (i=2;i<100;i++)    {        for (j=2;j<=sqrt(i);j++)        {            if (i%j==0) goto loop;        }        printf("%d ",i);        loop:;    }}


[解决办法]
C/C++ code
#include<math.h>#include<stdio.h>int main(){    int i,j;    for (i=2;i<100;i++)    {        for (j=2;j<=sqrt(i);j++)        {            if (i%j==0)             {                break;            }        }        if(j>sqrt(i))printf("%d ",i);    }    return 0;}