السلام عليكم ورحمة الله وبركاته
اخواني الأعزاء في هذا المنتدى الرائع
هذه هي أولى مشاركاتي معكم ويسعدني كثيرا ان اكون بينكم
أنا طالب مبتدأ في لغة السي ++ ولدي بعض المشاكل
لدي سؤال حاولت الاجابه عليه بما أعرف وأرجو منكم المساعده
A prime number is an integer that is only divisible by itself and 1. One of the simplest algorithms to find prime numbers is the “sieve of Eratosthenes” which can find all primes up to some specified limit by brute force. For example, to find all primes up to twenty we can visualise the process using a number line, shown below. We begin with the divisor 2 and record a mark for all multiples of two, i.e. 4, 6, 8 and so on. Then we do the same for 3, marking 6, 9, 12, and so on. We continue this process until there are no more divisors up to the specified limit; in this case we needn’t continue past the divisor 10 since the limit is 20. The primes are those that, after this procedure has been carried out, have no marks against them; i.e. 1, 2, 3, 5, 7, 11, 13, 17, 19. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Write a program that implements the sieve of Eratosthenes up to a limit of 2000. Use an integer array of 2000 elements all initialised to zero. By following the procedure outlined above begin entering non-zero values in the elements of the array corresponding to multiples of integer values, beginning with the divisor 2 and ending with the divisor 1000. Finally, you need to find those array elements still containing zero at the end of the process. No input is required by the user. Your programme should begin, output all of the primes up to 2000, and then terminate.Design a flow-chart that implements its functionality.
قمت بتصميم "الفلو تشارت" ولكني غير متأكد من صحته؟ ويجب علّي تسليمه غدا
أما بالنسبه للـ "الكود" فسأضع حلي قريبا حينما أنتهي منه حيث أن تسليمه سيكون الأسبوع القادم فلا تبخلوا علي بمداخلاتكم البناءه
ولكم جزيل الشكر
MKF