Java Program to find Prime Numbers Between 1 to 100
ฝัง
- เผยแพร่เมื่อ 6 มิ.ย. 2019
- In this video we will learn how to write a java program to find prime numbers between 1 to 100.
Prime Number:
It is a number that is divided by itself or 1. That means we can not divide other number than 1 or itself.
Example:
2,3,5,7,11,13,17.....
Please correct the above program with open and close brackets:
1. add open bracket in 12th line
2. close bracket after 15th line
3. add open bracket in 16th line
4. finally add close bracket in the last line in the program...
Sorry for the inconvenience ....in the coming session will not happen like this.
Thank you for your cooperation .... - วิทยาศาสตร์และเทคโนโลยี
It is displaying odd numbers not prime numbers
Absolutely
Yes.
Now change the code like this way
if(i%j==0)
{
s=1;
break;
}
Now it prints prime numbers.
yaaaa it is not correct .the code is wrong that is not prime numbers plzzz check it sir
Thank you for Video. It Helped me alot @lucky techzone
Great video! Awesome solution! Keep up the great work!!👌👍👏
Happy to help
Great explaination🙏
what is the purpose of j++ it also gets incremented in the 2nd iteration right ?
Extraordinary explanation. Thanks a lot sir
Thankyou very much 👍👍 keep watching 👍👍
@@byluckysir
Sir, in this what is purpose of j++
J++ not update..
Explain how to get the given number(using scanner class) is prime or not.... Please
Awesome coding
Thanks for the explanation!
Glad it was helpful!
Happy to help
explanation ok but i have small dought why did you take scanner method
Scanner can use tokenize using custom delimiter and parse the stream into primitive types of data
The break statement should be inside the if condition
Nice explaination sirr
Happy to help
In this code what purpose of j++
Thank u bro
Most welcome 👍👍
Really super explanation
I like the explanation
class primeNumber
{
public static void main(String args[]){
int i,s,j;
for(i=2;i
@@byluckysir The logic you used doesn't work for prime number please verify your logic again. Your logic is able to print other than prime numbers also. For eg: 9,15,21,27 and so on
@@varakits1062 Thank you for your comment, In this program logic works perfectly but open and close bracket issue crates wrong output, I suggest you check video description where i explained in detail..Thank you for your cooperation.
Software programming development for the further interview
How the hell is 9 a prime number? 9 can be divided by 3 as well sir...then I saw description..Thank you
So do you got desired output???
If so, kindly share the correct program
If condition.
Switch case..
If else system
Public static void main
Multiples of 3 are coming in output bro is it wrong r what... ¿
Please check the description, logic is right, open and close brace wrong, i have instructed in the description please check 👍👍👍
No it is not correct in explaination also
Printing the same output as earlier
Either create new program with new link
Sir , prime numbers are like 2,3,5,7,11,13,17,23......97. In your output display only odd numbers did not get prime numbers please check once again in output.
i agree with you
Hi Ajay here is the correct code
int num = 100;
for(int i = 2;i
@@simhachalambure2230 second for loop lo j
J++ means what
++ is increment operator in java
J++ why not update ..
LOGIC IS WRONG DEAR FRIENDS
please check video description
How 9 is a prime number ?
Please check video description , little code correction required 👍👍