Write a C program to check that a given no. is positive or negative

 TASK-

Write a C program to check that a given no. is positive or negative.



CODE:

#include<stdio.h>
int main(){

int num;
printf("\tEnter the number: ");
scanf("%d",&num);


 //condition 
 

if (num>0)
 printf("\n\t%d is a positive number",num);
 else if (num<0)
 printf("\n\t%d is a negative number",num);
 else
 printf("\tThis is zero");

getchar();
return 0;
}

Expected Output:






NEED WORK PRODUCE WORK

My name is Abdul Rehman I am from Pakistan. I am doing BS in Computer and information sciences. Currently, I am creating these blogs to help students of computer sciences all over the world..

Post a Comment (0)
Previous Post Next Post