Write a program to input a number and check number is negative or not.
In this program we input a number and check number is negative or not means if number is less than Zero then number is negative or not.
#include<stdio.h>
#include<conio.h>
void main()
{
int n;
clrscr();
printf("Enter a number=");
scanf("%d",&n);
if(n<0)
printf("\nNegative number");
else
printf("Not negative number");
getch();
}
OUTPUT
You can follow me on Google+.
Subscribe for recently updates.
#include<stdio.h>
#include<conio.h>
void main()
{
int n;
clrscr();
printf("Enter a number=");
scanf("%d",&n);
if(n<0)
printf("\nNegative number");
else
printf("Not negative number");
getch();
}
OUTPUT
You can follow me on Google+.
Subscribe for recently updates.
Comments
Post a Comment