online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
#pragma warning(disable:4996) #include <stdio.h> // 표준 입출력 관련 기능을 제공하는 헤더 파일 #include <math.h> // 수학 함수를 제공하는 헤더 파일 int isPrime(int num); // 소수를 판별하는 사용자 정의 함수 선언 int isPrime(int num){ if (num <= 1) return 0; // num이 1보다 작거나 같으면 0을 반환 for (int i = 2; i <= sqrt(num); ++i){ if (num % i == 0) return 0; // 2부터 입력된 정수의 제곱근까지 반복 수행 } return 1; // 위 조건을 모두 통과하면 소수이므로 1 반환 } int main(){ // 프로그램 시작, main 함수 정의 int num; // 입력받을 정수를 저장할 변수 선언 // isPrime() 함수의 매개변수로, 함수 내부에서 사용되는 지역 변수 printf("정수를 입력하세요: "); scanf("%d", &num); if (isPrime(num)){ // 반환값에 따라 소수 여부 메시지 출력 printf("%d는 소수입니다.\n", num); } else{ printf("%d는 소수가 아닙니다.\n", num); } return 0; // 프로그램 종료 }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text
×

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue