WAP in C to display a number if user enters negative number. If user enters positive number, that number won’t be displayed.

#include<stdio.h>
#include<conio.h>
int main()
{
int number;
clrscr();
printf(“Enter an integer: “);
scanf(“%d”,&number);
// Test expression is true if number is less than 0
if(number < 0)
{
printf(“You entered %d.\n”, number);
}
printf(“C language for beginners.”);
getch();
return(0);
}

Output :-

ifif1

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s