Get Update on recent Technology & Programming

Wednesday, 15 November 2017

C Program to print a message if negative number is entered

Posted by   on Pinterest

C Program to print a message if negative number is entered




#include<stdio.h>

int main(void)

{

 int num;

 printf("Enter a number : ");

 scanf("%d",&num);

 if(num<0)

 {

  printf("Number entered is negative\n");

  num=-num;  

 }

 printf("Value of num is : %d\n", num);

 return 0;

}



No comments:
Write comments

Hey, we've just launched a new custom color Blogger template. You'll like it -
Join Our Newsletter