Wednesday, 7 October 2015

Write a CPP Program To Find Inputed Number is Positive Or Not

Write a CPP Program To Find Inputed Number is Positive Or Not
1:  #include<iostream.h>  
2:  #include<stdio.h>  
3:  int main()  
4:  {  
5:    int a;  
6:    cout << "Enter a number" << endl;  
7:    cin>>a;  
8:    if (a>=0)  
9:      cout << "Positive : " << a<<endl;  
10:    else  
11:      cout << "Negative : " << -a<<endl;  
12:  }  

No comments:

Post a Comment