J. Odd or Even
Problem link
https://algo.codemarshal.org/contests/diu-122-fl16-termwork/problems/J
Score: 1
CPU: 1s
Memory: 512MB
CPU: 1s
Memory: 512MB
Given an integer, your task is to determine whether it is odd or even.
Input
An integer n (1<=n<=100).
Output
If is n is odd print odd. Otherwise print even.
Samples
| Input | Output | 
|---|---|
| 5 | odd | 
| Input | Output | 
|---|---|
| 8 | even | 
Solution
#include<stdio.h> int main() { int n; scanf("%d",&n); if(n>=1 && n<=100){ if(n%2==0){ printf("even\n"); } else{ printf("odd\n"); } } return 0; }
 
No comments:
Post a Comment