Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- double negpos(double n)
- {
- if(n<0.0)
- {
- return 1;
- }
- else if (n>0.0)
- {
- return 2;
- }
- else if (n==0.0)
- {
- return 3;
- }
- }
- int main ()
- {
- double n,ans;
- scanf("%lf",&n);
- ans=negpos(n);
- if(ans==1)
- {
- printf("negative number");
- }
- else if (ans==2)
- {
- printf("positive number");
- }
- else if (ans==3) {
- printf("zero");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement