C program to find prime number from 1 to 100 numbers using function

C program to find prime number from 1 to 100 numbers using function , Write a program to print prime numbers from 1 to 100 numbers. Write a c program to find prime numbers using function.

Write a program to print prime numbers from 1 to 100 numbers.

Write a c program to find prime numbers using function.

C program to find prime number from 1 to 100 numbers using function

C Code


#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("%d\t",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


You May Also Like...

Socialize with Us