Welcome

>>>Welcome to my "CODE BAZAR"
Code marshal
URI online judge
Others
Code marshal
URI online judge
Others
Code marshal
URI online judge
Others

Update ✔✔✔ Upcoming programming book (.pdf) "Programming Contest (data structures and algorithms) by Md. Mahbub Hasan & "Graph Algorithms" by Safayat Asraf "****** Date: 20 March, 2019****Hazrat Ali****

Sunday 30 October 2016

I. Am I Negative?
Problem link
https://algo.codemarshal.org/contests/diu-122-fl16-termwork/problems/I

Score: 1

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

InputOutput
100100
InputOutput
-25-25 Negative
Solution

#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