C program to list prime numbers up to a certain number

C program to list prime numbers up to a certain number

#include <stdio.h>
#include <stdbool.h>

bool check_prime(int);

int main(){
	int i, n, result;
	
	printf("Enter the upper limit of the required prime numbers: \n");
	scanf("%d",&n);
	printf("Prime numbers from 0 to %d are: \n", n);
	
	for(i=0; i < n; i++){
		result = check_prime(i);
		/*if i is prime then it will return true*/
		
		if ( result == true )
		printf("%d \n", i);
	}
	
	return 0;
}


bool check_prime(int a){
	int c;
	
	// check for factors
	for ( c = 2 ; c <= a - 1 ; c++ ){
		if ( a%c == 0 )
		return false; // if factor found
		}
	return true;   // if factors not found
}