Header Ads

Header ADS

1066.Count even and odd positive and negative number in python

This is the solution of this problem in python:

a=float(input())
b=float(input())
c=float(input())
d=float(input())
e=float(input())
Ecount=0
Ocount=0
Pcount=0
Ncount=0
if(a%2==0):
    Ecount+=1
elif(a%2!=0):
    Ocount+=1
if(a>0):
    Pcount+=1
if(a<0):
    Ncount+=1

if(b%2==0):
    Ecount+=1
elif(b%2!=0):
    Ocount+=1
if(b>0):
    Pcount+=1
if(b<0):
    Ncount+=1

if(c%2==0):
    Ecount+=1
elif(c%2!=0):
    Ocount+=1
if(c>0):
    Pcount+=1
if(c<0):
    Ncount+=1

if(d%2==0):
    Ecount+=1
elif(d%2!=0):
    Ocount+=1
if(d>0):
    Pcount+=1
if(d<0):
    Ncount+=1

if(e%2==0):
    Ecount+=1
elif(e%2!=0):
    Ocount+=1
if(e>0):
    Pcount+=1
if(e<0):
    Ncount+=1

print("%i valor(es) par(es)"%Ecount)
print("%i valor(es) impar(es)"%Ocount)
print("%i valor(es) positivo(s)"%Pcount)
print("%i valor(es) negativo(s)"%Ncount)

No comments

Powered by Blogger.