+ 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
11 Answers
+ 1
zay yar ,
Search discussions for "c prime".
Some other threads have code you can learn from.
+ 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.
+ 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.)
+ 3
zay yar , what is a prime number?
+ 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đ
+ 1
https://code.sololearn.com/cr3go36r8fHi/?ref=app
zay yar , Check this one.
+ 1
Tibor Santa thank you so much for your a hint. It is very useful for međ
+ 1
Rain thank you for your a hintđ
+ 1
Imara Mohideen thank you so much for your help it is very useful for me now i know how to write correctlyâ€âș
0
plz use c language
0
Any idea any people show