Ad Code

Responsive Advertisement

1066 - Even, Odd, Positive and Negative

Author: Ismail Hosen

Daffodil International University





Problem Link

//Please follow from main function



#include<stdio.h>


int main()


{


    int i, n, count1=0, count2=0, count3=0, count4=0;


    for(i=1; i<=5; i++)


    {


        scanf("%d", &n);


        if(n%2==0)


        {


            count1=count1+1;


        }


        if(n<0)


        {


            count2=count2+1;


        }


        if(n>0)


        {


            count4=count4+1;


        }


        if(n%2!=0)


        {


            count3=count3+1;


        }


    }


    printf("%d valor(es) par(es)\n", count1);


    printf("%d valor(es) impar(es)\n", count3);


    printf("%d valor(es) positivo(s)\n", count4);


    printf("%d valor(es) negativo(s)\n", count2);


    return 0;


}





Post a Comment

0 Comments