public class countposneg
{ public static void main(String args[]) throws IOException
{ InputStreamReader read = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(read);
int arr[] = new int[575];
int j=2;
System.out.println("Enter a list of numbers(terminates on entering 0)");
for(int i=0;j<3;i++)
{ arr[i] = Integer.parseInt(br.readLine());
if(arr[i]==0)
{j++; }
}
int neg=0, poseve=0, posodd=0;
for(int i=0;i
{neg++;}
if(arr[i]>0 && arr[i]%2==0)
{poseve++;}
if(arr[i]>0 && arr[i]%2==1)
{posodd++;}
}
System.out.println("\n\nNumber Of Negative Numbers: "+neg);
System.out.println("Number Of Positive Even Numbers: "+poseve);
System.out.println("Number of Positive Odd Numbers: "+posodd);
}
}
there are a lots of error in it
ReplyDeletela gopi
Deletegopi maga
thu
Delete