01/10/2018, 17:37

Tại sao code bị lỗi expected declaration or statement at end of input

Đề bài yêu cầu in ra các số nguyên tố trong khoảng [10000; 10000000] Mình mới học C code báo lỗi này là sao hả mọi người ? [Error] expected declaration or statement at end of input

#include<stdio.h>
#include<math.h>

int Prime(int n){
	for(int i = 2; i <= sqrt(n); i++){
		if(n%i == 0){
			return 0;
		}	
	return 1;
}

int main(){
	printf("Cac so tu nhien tu 5 den 7 chu so thoa man:
");
	printf("La so nguyen to:
");
	for(int i = 10000; i < 10000000; i++){
		if(Prime(i) == 1){
			printf("%5d", i);
		}
	}
	return 0;
}
Trương Tấn Phát viết 19:46 ngày 01/10/2018

Hàm Prime thiếu 1 dấu ngoặc nhọn đóng hàm.

Bài liên quan
0