C program to find prime number from 1 to 100 numbers 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;
}

Output

TutsMaster.org

Tutsmaster.org provides tutorials related to tech and programmings. We are also setting up a community for the users and students.