Job Recruitment Website - Property management company - C# programming problem: write a function to calculate the number of prime numbers in the interval of 500-800, and add and subtract intervals to calculate the sum in descending order.
C# programming problem: write a function to calculate the number of prime numbers in the interval of 500-800, and add and subtract intervals to calculate the sum in descending order.
Hello, the procedure is as follows, only playing mobile games.
# include & ltstdio.h & gt
# include & ltmath.h & gt
int main()
{
int i,m,cn=0,sum=0,sign = 1;
for(m = 799; m & gt=500; m-=2)? //Because even numbers must not be prime numbers?
{
for(I = 2; I< = sqrt (m); i++)
If (m%i==0)
Break;
If (i & gtsqrt(m))
{
cn++;
Sum+= symbol * m;;
sign =-sign;
}
}
printf("%d? %d? \n”、cn、sign); ?
}
- Previous article:Where is Earl Heze International Garden?
- Next article:Where do I get off the bus from Chifeng 66 to 99?
- Related articles
- What is the telephone number of Taian Yejia Taishan Jiuxi Marketing Center?
- Who is the developer of Dehui Garden?
- Taiyuan Vanke Blue Mountain Taiyuan Vanke Blue Mountain
- Where is the address of Hanlin Building in Gu 'an, Quanguo?
- Where is the address of Jinlin Peninsula in Tongren?
- What aspects does the security system of intelligent community include?
- How about Zhongshan Torch Development Zone Construction and Development Co., Ltd.?
- How to deal with foreigners' belongings seized by property?
- When will the capital of Xishuangbanna be handed over?
- How far is the Upper East Zone of Country Garden in Zhangjiagang from Tangqiao High School?