素数的C程序 [英] C program on prime numbers

查看:74
本文介绍了素数的C程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一个数字是质数,如果它的唯一除数是1并且它本身.所有小于100的非素数都将有一个2到10的除数.鉴于上述陈述,编写一个C程序来计算所有小于100的素数.此外,还要借助各个流程图来说明您的工作.

A number is prime if its only divisors are 1 and itself. All non-prime numbers less than 100 will have a divisor between 2 and 10. In view of the above statements, write a C program which computes all the prime numbers less than 100. Explain your work with the help of individual flow charts in addition to C code.

推荐答案

好吧,假设您真的不知道如何做作业.然后,我将为您提供有关算法的提示(不过,没有代码,因为这实际上是您必须自己完成的事情).您可以使用灵蛇怪筛子 algorhthm
All right, let''s assume you really ABSOLUTELY have no idea on how to do your homework. I''ll give you a hint on algorithm (no code, though, as this is something you really must do by yourself) then. You could use Sieve of Eratosthenes algorhthm


在这里不起作用.
抱歉,这里没有快速提问.这听起来像是您的大学项目/作业,您应该付出一些努力.

我们希望您花一些时间来解决您面临的问题,然后再花一些时间来提出问题,同时在此处发布.

这是询问者的期望:
1. 先尝试您要做什么!
2.制定看起来像问题/无法解决的问题.

试试看,告诉他们是否遇到问题.
成员将非常乐于提供这样的帮助.
It does not work like this here.
I am sorry but there is no quick question here. This sounds like your college project/assignment, you should put some effort.

We expect you to put some time in trying the issue that you are facing and then some time in formulating the question while posting here.

Here is what is expected by enquirers:
1. TRY first what you want to do!
2. Formulate what was done by you that looks like an issue/not working.

Try them and tell if you face issues.
Members will be more than happy to help like this.


我认为没有人愿意为您解决这个琐碎而无聊的问题.是的,这很简单.

此外,您对有人为您做的事情不感兴趣.您确实需要自己完成所有的作业-在不久的将来会得到很好的回报.如果不这样做,您就会失去太多学习知识的机会.如果您对学习不感兴趣,那么此专业(以及任何其他创造性的工作)不适合您.

—SA
I don''t think anyone is interested to solve this trivial and boring problem for you. Yes, it is trivial.

Moreover, you are not interested in someone doing it for your. You really need to do all your school assignments by yourself — is will pay off very well in near future. If you don''t you loose too many chances to learn something. If you are not deeply interested in learning, this profession (and any other creative work) is not for you.

—SA


这篇关于素数的C程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆