Write a Program to Print prime number c language , java language and python language by technic dude

## Program to Print prime number in C – Language

```
#include<stdio.h>
int main(){
int n,i,m=0,flag=0;
printf("Enter the number to check prime number:");
scanf("%d",&n);
m=n/2;
for(i=2;i<=m;i++)
{
if(n%i==0)
{
printf("not prime number");
flag=1;
break;
}
}
if(flag==0)
printf("prime number");
return 0;
}
```

## Output:

```
Enter the number to check prime:56
not prime number
Enter the number to check prime:23
prime number
```

### Program to Print prime number in JAVA Language

```
class PrimeNumbers
{
public static void main (String[] args)
{
int i =0;
int num =0;
String primeNumbers = "";
for (i = 1; i <= 100; i++)
{
int counter=0;
for(num =i; num>=1; num--)
{
if(i%num==0)
{
counter = counter + 1;
}
}
if (counter ==2)
{
//Appended the Prime number to the String
primeNumbers = primeNumbers + i + " ";
}
}
System.out.println("Prime numbers from 1 to 100 are :");
System.out.println(primeNumbers);
}
}
```

## Output:

```
Prime numbers from 1 to 100 are :
2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97
```

### Program to Print prime number in PYTHON Language

Python program to display all the prime numbers within an interval lets impalements this code

```
lower = 900
upper = 1000
print("Prime numbers between", lower, "and", upper, "are:")
for num in range(lower, upper + 1):
# all prime numbers are greater than 1
if num > 1:
for i in range(2, num):
if (num % i) == 0:
break
else:
print(num)
Output
```

## Output:

```
Prime numbers between 900 and 1000 are:
907
911
919
929
937
941
947
953
967
971
977
983
991
997
```

## 0 Comments