+ 1

what a program user enter is prime number. example if user enter 7. 7 is prime number. if enter 6. 6 is not prime.no#plz help me

using c language https://code.sololearn.com/ch2Op891xXI7/?ref=app

17th Nov 2023, 2:55 PM
zay yar
zay yar - avatar
11 odpowiedzi
+ 1
zay yar , Search discussions for "c prime". Some other threads have code you can learn from.
17th Nov 2023, 10:16 PM
Rain
Rain - avatar
+ 7
zay yar , befor asking for help, you should do a try by yourself first. > put your code try in sololearn playground and link it here.
17th Nov 2023, 2:59 PM
Lothar
Lothar - avatar
+ 5
zay yar, here is a hint for you. A prime number is divisible only by 1 and by itself. You have already used the modulo operator (%) in your code, and this is a good start. To test the number p for primality, the simplest approach is to check each number higher than 1 and lower than p, if p is divisible by it. You need to write a loop for this. If any of the numbers are divisible, then p is not a prime. (There are many possible optimization techniques to make this algorithm more efficient for larger numbers, but I am not going into that for now.)
17th Nov 2023, 5:32 PM
Tibor Santa
Tibor Santa - avatar
+ 3
zay yar , what is a prime number?
17th Nov 2023, 4:44 PM
Solo
Solo - avatar
+ 1
Lothar dear teacher i saw your comment and i did it thz for comment me plz teach me how to write plz. thz for teaching sorry for my English skill😑
17th Nov 2023, 3:32 PM
zay yar
zay yar - avatar
18th Nov 2023, 3:50 AM
Imara Mohideen
Imara Mohideen - avatar
+ 1
Tibor Santa thank you so much for your a hint. It is very useful for me😊
18th Nov 2023, 9:58 AM
zay yar
zay yar - avatar
+ 1
Rain thank you for your a hint😊
18th Nov 2023, 10:00 AM
zay yar
zay yar - avatar
+ 1
Imara Mohideen thank you so much for your help it is very useful for me now i know how to write correctly❤☺
18th Nov 2023, 10:06 AM
zay yar
zay yar - avatar
0
plz use c language
17th Nov 2023, 2:56 PM
zay yar
zay yar - avatar
0
Any idea any people show
19th Nov 2023, 6:42 AM
MOHD AMIR
MOHD AMIR - avatar