C语言题目9

IT小小龙 posted @ 2014年4月06日 16:17 in C with tags 素数 , 687 阅读
//打印100以内的素数
#include"stdio.h"
int main()
{
  int i;
  int j;
  int flag = 1;
  for(i=2; i<100; i++)
    {
      flag = 1;
      for(j=i-1; j>1; j--)
	{
	  if(i%j == 0)
	    {
	      flag = 0;
	      break;
	    }
	}
      if(flag == 1)
	{
	  printf("%d ", i);
	}
    }
  printf("\n");
  return 1;
}
Avatar_small
Kar 7th Class Questi 说:
2022年9月21日 13:57

All Karnataka Secondary Education Board Government and private school students can download those subject wise new syllabus Kar 6th, 7th, 8th, 9th Question Paper 2023 Kar 7th Class Question Paper with bit questions for guessing important questions of SA-1, SA-2, SA-3, SA-4 and FA-1, FA-2, FA-3, FA-4 examination tests with annual final public examination tests 2023, every year the KSEEB is announced high school level STD-6, STD-7, STD-8, STD-9 study material with IMP question bank to both medium students of KSEEB.


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter