Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: Prap

Problemset: เส้นทางคณิตศาสตร์

Language: c

Time: 0.002 second

Submitted On: 2025-10-02 20:10:17

#include <stdio.h>
int main() {
	int x,y,z,ans;
	scanf("%d %d %d",&x,&y,&z);
	if (z==1) {
		ans = x+y;
	}
	else if (z==2) {
		ans = x-y;
	}
	else if (z==3) {
		ans = x*y;
	}
	else if (z==4) {
		if (y==0) {
			printf("cannot divide by zero");
			return 0;
		}
		else {
			ans = x/y;
		}
	}
	else {
		if (y==0) {
			printf("cannot divide by zero");
		}
		else {
			ans = x%y;
		}
	}
	printf("%d",ans);
}