visit my website to get all the java tutorials links (Chapter Wise) :

http://smartprogramming.in

—————————————————————————————————-

Contact to have all-in-one Java training with me.

Contact No : +91 62838-30308 (Whats App Also Available)

Email ID : smart.programming.2101@gmail.com

—————————————————————————————————-

Program to Print All Prime Numbers between 1 to…

Something is wrong

Thanks sir

for(int n=2;n<=number/2;n++);

it is not neccessary to check for all values number less then on 1(n<number-1) .unwanted checking

1 is not a prime number

This is wrong programme 1 is not prime number and temp is not necessary.

In Eclipse ,This pogramme showing output only 1 and 2.

Sir agar accept karne ho numbers

sir can u explain why did u use i<no-1

Sir in this program prime no 2 is printed but how

Sir can u please explain the working of the loop at the point of j<i-1.

What value does i hold

Because i dont understand

How we can find the sum of prime number between 1 to 100

Sir what value does temp store? Is it the value of the remainder? Also in one of the if statements why if(temp == 0) then i that is the prime number is printed? If the remainder is 0 that means that the number was divisible right sir? Please explain! My exams are on Monday!

Sir special number pe bhi ek tutorial dijiye pls

sir my book says it…(below). my text Book's question is "print the series of the prime number up to 25, using nested for loop"

is this program right or wrong..? I am from Bangladesh so please explain me with some easy Hindi.and what is "temp" you used in your program..?I will be so grateful to you.

public class prime

{

public static void main(string args [])

{

int i j ;

System.out.println("series of Prime number upto 25 is :n");

for(i=2,i<=25;i++)

{

for (j=2;j<=i;j++)

{

if (i%j= =0)

break;

}

if(i= =j)

System.out.print(" "+i+" ");

}

}

}

Modulas or temp define krdo dpk sir

Simple Armstrong Program IS Here

package com.java.practice;

import java.util.Scanner;

public class ArmstrongNumber {

@SuppressWarnings("resource")

public static void main(String[] args) {

Scanner scanner=new Scanner(System.in);

System.out.println("Enter Number to check:");

int number=scanner.nextInt();

int r,rev=0;

int save=number;

while (number!=0)

{

r=number%10;

rev=rev+r*r*r;

number=number/10;

}

if(save==rev)

{

System.out.println("Armstrong");

}

else

System.out.println("Not armstrong");

}

}

Sir in second for loop j<=i-1 at the starting the condition is failed

If you do like this

For(i=2;I<=100;I++)

{

For(j=2;j>=i-1;j++)

{ Sir then your code is true

Best explanation

This is ur simple program or complex program to print prime no ??? Strange

Good explained

suppose i want to give the range as 150 using scanner class and want to print the prime nos from the given range..pls do rply

sir i want to print a range of prime numbers using scanner class

For your kind information 1 is not prime ….The definition of a prime number is a positive integer that has exactly two positive divisors. However,1 only has one positive divisor (1itself), so it is not prime.

thank u sir your videos help me a lot in my studies

Is it necessary to give temp

Sir collection v video banayiye plz

Sir….. my solution

import java.util.Scanner;

public class Program

{

public static void main(String[] args) {

Scanner obj=new Scanner(System.in);

int x=obj.nextInt();

int a=1;

int d=2,e=0;

while(a<=x){

e=0;

for(d=2;d<=a;d++){

if(a%d==0){

e++;

}

}

if(e==1){

System.out.print(a+", ");

}

a++;

}

}

}

please explain here is 2%2==0 ho rha he to kaise 2 print karega because condition true ho jaegi and temp=1 hoga

Good

lekin 1 to prime no nhi h