Re: [請益] 誰會c++阿>.<
下面是完整的程式了 我跑過也改過了 你看看吧...
有不懂的地方在問我~
#include<stdio.h>
bool isPrime(int x)
{
int i;
int tmp = 0;
for(i=2;i<x;i++)
{
if(x%i==0)
tmp = tmp + 1;
}
if(tmp == 0)
return true;
else
return false;
}
void main()
{
int m,n,x;
int c=0 ;
printf("please enter first number:") ;
scanf("%d",&m);
printf("please enter second number:") ;
scanf("%d",&n);
for(x=m;x<=n;x++)
{
if (isPrime(x) == true)
{
c=c+1 ;
}
}
printf("there are %d primes\n",c);
}
--
So go and think about Whatever you need to think about
Go on dream about Whatever you need to dream about
Then come back to me When you know just how you feel
~★ Avril Lavigne ★~
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 203.204.90.148
推
推 61.216.61.49 04/19, , 1F
推 61.216.61.49 04/19, 1F
推
推 61.216.141.17 04/19, , 2F
推 61.216.141.17 04/19, 2F
推
推 219.68.105.125 04/19, , 3F
推 219.68.105.125 04/19, 3F
推
推210.240.172.123 04/19, , 4F
推210.240.172.123 04/19, 4F
討論串 (同標題文章)