I. Am I Negative?
Problem linkhttps://algo.codemarshal.org/contests/diu-122-fl16-termwork/problems/I
Score: 1
CPU: 1s
Memory: 512MB
CPU: 1s
Memory: 512MB
Given an integer number, your task is to figure out whether it is negative or not.
Input
An integer n (-100<=n<=100)
Output
In the first line, print the input integer. Then if this number is negative, print the word Negative on the second line.
Samples
Input | Output |
---|---|
100 | 100 |
Input | Output |
---|---|
-25 | -25 Negative |
#include<stdio.h> int main() { int n; scanf("%d",&n); if(0<=n && n<=100){ printf("%d\n",n); } else if(-100<=n && n<0){ printf("%d\nNegative\n",n); } return 0; }
No comments:
Post a Comment