Skip to main content

Posts

Showing posts with the label 15. Write a C program to check whether a number is negative

ads1

15. Write a C program to check whether a number is negative, positive or zero.

  15. Write a C program to check whether a number is negative, positive or zero. Solution :-  #include<stdio.h> #include<conio.h> void main() {     clrscr();     int a;     printf("Enter the number :-");     scanf("%d",&a);     if (a>0)     {         printf("%d The number is Positive....");     }     else if(a<0)     {         printf("%d The number is Negative......");     }     else     {         printf("%d The number is Zero......") ;     } getch(); } Output :-     

ads2