C++ Program - Prime Numbers between 1 and n

preview_player
Показать описание
C++ Program - Prime Numbers between 1 and n

Write a C++ to generate all the prime numbers between 1 and n, where the value of n to be taken from the user.

#program #primenumbers
Рекомендации по теме
Комментарии
Автор

Sir in which software are u writing the code?

tanmayeeghosh
Автор

can you explain why you use i<=x/2 in the inner for loop?

songbirb
Автор

forgive my stupid brain. why do we use i/2? like why do we only divide till the half of the number? do you mean that a number x cannot be divided by a number y that if y was a number located between 1/2 x and x? i mean like :1/2 x < y < x. iam really sorry iam bad at explaining hope you understood what i meant

hpexaltedblade
Автор

why should we return -1?and why not any other number?

nitinchinmay