« Back to profile of ahmed_sa

  • Java

    java how to program 7th ch solutions

    java how to program 7th ch solutions ch2 ex-32

    18:10 Jul 28 2010 | Tags :
    						/**************************
*  Name: Ahmed Alsaqqa    *
*  july/2010              *
*  Java How To Prog. 7th  *
*        ch-2             *
***************************/

import java.util.*;
public class ex2_32 {
     public static void main (String args[]){
     int x,zer=0,poz=0,neg=0;
     Scanner input = new Scanner(System.in);  
     	System.out.print("Enter first NUM:");
     	x=input.nextInt();
     	if(x==0)
     	zer++;
     	if(x>0)
     	poz++;
      if(x<0)
      neg++;
     	    
     	System.out.print("Enter second NUM:");
     	x=input.nextInt(); 
     	if(x==0)
     	zer++;
     	if(x>0)
     	poz++;
      if(x<0)
      neg++;     	
     	     
     	System.out.print("Enter third NUM:");
     	x=input.nextInt(); 
     	if(x==0)
     	zer++;
     	if(x>0)
     	poz++;
      if(x<0)
      neg++;     	
     	
     	System.out.print("Enter third NUM:");
     	x=input.nextInt(); 
      if(x==0)
     	zer++;
     	if(x>0)
     	poz++;
      if(x<0)
      neg++;    	
     	
     	System.out.print("Enter third NUM:");
     	x=input.nextInt(); 
     	if(x==0)
     	zer++;
     	if(x>0)
     	poz++;
      if(x<0)
      neg++;     	

      System.out.printf( "\nThere are %d zeros\n", zer );
      System.out.printf( "There are %d positive numbers\n", poz );
      System.out.printf( "There are %d negative numbers\n",  neg );
           
     }
}    			         
Add comment
To add a comment, please : Login or Sign up
    ahmed_sa
    Ahmed Alsaqqa
  • New visitor?

    On setCode, you can save your codes, functions and classes, you can also share them with your friends, and track your favorite developer

    Join the SetCode community
  • Your language here :