**What is Prime number :-
Prime number is a number that is greater than 1 (>1) and Divided by 1 or as same. We can't Divide this number with other numbers like 2,3,4.................n .The examples of Prime numbers are 2,3,5,7,11,13,19,17,23,29 etc.
Let's see the Prime number program in C . In this C program we take an input for understand the Range .
*Let's see the program---
#include <stdio.h>
int main()
{
int i, num, n, count;
printf("Enter the range: \n");
scanf("%d", &n);
printf("The prime numbers in between the range 1 to %d:",n);
for(num = 1;num<=n;num++){
count = 0;
for(i=2;i<=num/2;i++){
if(num%i==0){
count++;
break;
}
}
if(count==0 && num!= 1)
printf("%d ",num);
}
return 0;
}
INPUT :-
OUTPUT:-
IF YOU HAVE ANY QUARRIES SO YOU CAN DIRECTLY CONTACT WITH US,GO INTO THE CONTACT INFORMATION PAGE AND THEN TYPE YOUR QUARRIES .
THANKS FOR VISITING . IF YOU LOVE PROGRAMMING THEN YOU CAN FOLLOW OUR WEBSITE.
No comments:
Post a Comment