Write a program to find all the prime numbers up to a given number
Answers
Answered by
0
#include<stdio.h>
void main()
{
int n,i,fact,j;
printf("Enter the Number");
scanf("%d",&n);
printf("Prime Numbers are: \n");
for(i=1; i<=n; i++)
{
fact=0;
for(j=1; j<=n; j++)
{
if(i%j==0)
fact++;
}
if(fact==2)
printf("%d " ,i);
}
getch();
}
This is a program to find all the prime numbers up to a given number.
PLZ MARK ME AS BRAINLIEST.
Answered by
0
Answer:
input is 7 what is the output
Similar questions