C Programming

# C – Find Prime Number from 1 to 100 Using the Function

Find prime number from 1 to 100 numbers using the function on C program.

#include <stdio.h>

#include <conio.h>

int primenumber (int number);

void main()

{

int i;

printf("given numbers are prime numbers :n");

for(i =1; i<=100; i++)

{

if(primenumber(i))

printf("%dt",i);

}

getch();

}

int primenumber(int number){

int i, flag=1;

for(i=2; i<=number/2; i++){

if(number%i==0)

flag = 0;

}

return flag;

}