Saturday, June 25, 2016

SOLUTION OF URI 1847


//    Solution  of  1847 Welcome to the Winter!
//   (Mahmud_Jamil) BRUR






#include <stdio.h>
int main()
{
    int a,b,c;
    scanf("%d%d%d", &a, &b, &c);
    if(a>b)
    {
        if(b>c)
        {
            if((b-c)<(a-b)) printf(":)\n");
            else printf(":(\n");
        }
        else printf(":)\n");
    }
    else if(b>a)
    {
        if(c>b)
        {
            if((c-b)<(b-a)) printf(":(\n");
            else printf(":)\n");
        }
        else printf(":(\n");
    }
    else if(c>b) printf(":)\n");
    else printf(":(\n");
    return 0;
}


SOLUTION OF URI 1837


//   (Mahmud_Jamil) BRUR
//    Solution  of  1837 Preface






#include <stdio.h>
int main()
{
    int a,b,c,d,e,f,q,r;
    scanf("%d%d", &a, &b);
    if(a<0)
    {
        e=b;
        if(b<0) e=b*-1;
        for(r=0; r<e; r++)
        {
            f=a-r;
            if(f%b==0) break;
        }
        q=f/b;
    }
    else
    {
        q=a/b;
        r=a%b;
    }
    printf("%d %d\n",q,r);
    return 0;
}


Friday, June 24, 2016

Thursday, June 23, 2016

SOLUTION OF URI 1185



//    (Mahmud_Jamil) BRUR
//  1185 Above the Secundary Diagonal





#include <stdio.h>
int main()
{
    double a=0.0, M[12][12];
    char T[2];
    int C,x,y,z,p=10;
    scanf("%s", &T);
    for(x=0;x<=11;x++)
    {
        for(y=0; y<=11; y++)
        scanf("%lf", &M[x][y]);
    }
    for(z=0; z<=10;z++)
    {
        for(C=0; C<=p;C++)
            a+=M[z][C];
        p--;
    }
    if(T[0]=='S')
        printf("%.1lf\n",a);
    else if(T[0]=='M')
    {
        a=a/66.0;
        printf("%.1lf\n",a);
    }
    return 0;
}


SOLUTION OF URI 1184


//  1184   (Mahmud_Jamil) BRUR
// 

Below the Main Diagonal





#include <stdio.h>
int main()
{
    double a=0.0, M[12][12];
    char T[2];
    int C,x,y,z,p=0;
    scanf("%s", &T);
    for(x=0;x<=11;x++)
    {
        for(y=0; y<=11; y++)
            scanf("%lf", &M[x][y]);
    }
    for(z=1; z<=11;z++)
    {
        for(C=0; C<=p;C++)
            a+=M[z][C];
        p++;
    }
    if(T[0]=='S')
        printf("%.1lf\n",a);
    else if(T[0]=='M')
    {
        a=a/66.0;
        printf("%.1lf\n",a);
    }
    return 0;
}


SOLUTION OF URI 1175


//  1175   (Mahmud_Jamil) BRUR
// 
Array change I





#include <stdio.h>
int main()
{
   int N[20], temp,i,j;
    for(i=0; i<20; i++)
        scanf("%d",&N[i]);
    for(i=0, j=19; i<10; i++, j--)
    {
        temp=N[i];
        N[i]=N[j];
        N[j]=temp;
    }
    for(i=0; i<20; i++)
        printf("N[%d] = %d\n",i,N[i]);
    return 0;
}




SOLUTION OF URI 1174


//  1174   (Mahmud_Jamil) BRUR
//  Array Selection I





#include <stdio.h>
int main()
{
    double A[100];
    int i;
    for(i=0; i<=99; i++)
        scanf("%lf", &A[i]);
    for(i=0; i<=99; i++)
    {
        if(A[i]<=10.0)
            printf("A[%d] = %.1lf\n",i, A[i]);
    }
    return 0;
}



SOLUTION OF URI 1172


//  1172   (Mahmud_Jamil) BRUR
//  Array Replacement I




#include <stdio.h>
int main()
{
    int N[10], temp,i,j;
    for(i=0; i<10; i++)
        scanf("%d",&N[i]);
    for(i=0; i<10; i++)
    {
        if(N[i]<=0)
            N[i]=1;
    }
    for(i=0; i<10; i++)
        printf("X[%d] = %d\n",i,N[i]);
    return 0;
}






SOLUTION OF URI 1165


//  1165   (Mahmud_Jamil) BRUR
// 
Prime Number




#include <stdio.h>
#include <math.h>

int prime(int x)
{
    int i, root;
    if(x<2)
        return 0;
    if(x==2)
        return 1;
    if(x%2==0)
        return 0;
    root=sqrt(x);
    for(i=3; i<=root; i=i+2)
    {
        if(x%i==0)
            return 0;
    }
    return 1;
}
int main()
{
    int X,a,N;
    scanf("%d", &N);
    for(a=1;a<=N;a++)
    {
        scanf("%d", &X);
        if(1==prime(X))
            printf("%d eh primo\n", X);
        else if(0==prime(X))
            printf("%d nao eh primo\n", X);
    }
    return 0;
}




SOLUTION OF URI 1164



//  1164    (Mahmud_Jamil) BRUR
//  Perfect Number



#include <stdio.h>
int main()
{
    int N, X, a, b, c, d=0;
    scanf("%d", &N);
    for(a=1; a<=N; a++)
    {
        scanf("%d", &X);
        c=X/2; d=0;
        for(b=1; b<=c; b++)
        {
            if(X%b==0)
                d+=b;
        }
        if(d==X)
            printf("%d eh perfeito\n",X);
        else
            printf("%d nao eh perfeito\n",X);
    }
    return 0;
}





SOLUTION OF URI 1160


//  1160   (Mahmud_Jamil) BRUR
//   Population Increase




#include <stdio.h>
int main()
{
    int n, c, m;
    int a, b;
    double ac, bc;
    scanf("%d", &n);
    for(m=1; m<=n; m++)
    {
        c = 0;
        scanf("%d %d %lf %lf", &a, &b, &ac, &bc);
        while(a <= b)
        {
            a *= (ac / 100.0) + 1.0;
            b *= (bc / 100.0) + 1.0;
            c++;
            if (c > 100)
            {
                printf("Mais de 1 seculo.\n");
                break;
            }
        }
        if (c <= 100)
            printf("%d anos.\n", c);
    }
    return 0;
}






SOLUTION OF URI 1159


//  1159   (Mahmud_Jamil) BRUR
// 
Sum of Consecutive Even Numbers





#include <stdio.h>
int main()
{
    int x,a,b=0;
    while(1)
    {
        scanf("%d", &x);
        b=0;
        if(x==0)
            break;
        else if(x%2==0)
        {
            for(a=x; a<=x+8; a+=2) b+=a;
        }
        else
        {
            for(a=x+1;a<=x+9;a+=2) b+=a;
        }
        printf("%d\n", b);
    }
    return 0;
}






SOLUTION OF URI 1158


//  1158   (Mahmud_Jamil) BRUR
//  Sum of Consecutive Odd Numbers III




#include <stdio.h>
int main()
{
    int N, X, Y, a, b, c, d, e;
    scanf("%d", &N);
    for(a=1; a<=N; a++)
    {
        scanf("%d %d", &X, &Y);
        if(X%2==1)
        {
            c=0;
            for(b=1; b<=Y; b++)
            {
                c+=X;
                X+=2;
            }
            printf("%d\n", c);
        }
        else
        {
            X++;
            c=0;
            for(b=1; b<=Y; b++)
            {
                c+=X;
                X+=2;
            }
            printf("%d\n", c);
        }
    }
    return 0;
}





SOLUTION OF URI 1154



//  1154   (Mahmud_Jamil) BRUR
//  Ages




#include <stdio.h>
int main()
{
    int a,b=0;
    double c,d=0;
    while(1)
    {
        scanf("%d", &a);
        if(a<0)
            break;
        else
        {
            b+=a;
            d++;
        }
    }
    c=b/d;
    printf("%.2lf\n",c);
    return 0;
}







SOLUTION OF URI 1151



//  1151   (Mahmud_Jamil) BRUR
//  Easy Fibonacci





#include <stdio.h>
int main()
{
    int x,y, a=0,b=1,c=0;
    scanf("%d", &x);
    for(y=1; y<x; y++)
    {
        if(y%2==1)
        {
            printf("%d ",c);
            c=a+b;
            a=c;
        }
        else if(y==2)
            printf("%d ",c);
        else if(y%2==0)
        {
            printf("%d ",c);
            c=a+b;
            b=c;
        }
    }
    printf("%d\n",c);
    return 0;
}





SOLUTION OF URI 1150


//  1150   (Mahmud_Jamil) BRUR
//   Exceeding Z





#include <stdio.h>
int main()
{
    int a,b,c=0,x,z;
    scanf("%d", &x);
    do{
        scanf("%d", &z);
    }
    while(x>=z);
    for(a=x,b=0; b<z; a++)
    {
        b+=a;
        c++;
    }
    printf("%d\n", c);
    return 0;
}




SOLUTION OF URI 1149


//  1149   (Mahmud_Jamil) BRUR
//  Summing Consecutive Integers




#include <stdio.h>
int main()
{
    int X, N, a,b=0;
    scanf("%d %d", &X, &N);
    while(N<=0)
        scanf("%d", &N);
    for(a=1; a<=N; a++)
    {
        b+=X;
        X++;
    }
    printf("%d\n",b);
    return 0;
}



SOLUTION OF URI 1146


//  1146  (Mahmud_Jamil) BRUR
//  Growing Sequences





#include <stdio.h>
int main()
{
    int a,b;
    while(1)
    {
        scanf("%d", &a);
        if(a==0) break;
        else
        {
            for(b=1; b<a; b++)
                printf("%d ",b);
        }
        printf("%d\n",a);
    }
    return 0;
}




SOLUTION OF URI 1145


//  1145   (Mahmud_Jamil) BRUR
//  Logical Sequence 2






#include <stdio.h>
int main()
{
    int X,Y,z,a,b=0;
    scanf("%d%d", &X,&Y);
    for(a=1; a<=Y; a++)
    {
        b++;
        if(b==X) printf("%d",a);
        else printf("%d ", a);
        if(b==X)
        {
            b=0;
            printf("\n");
        }
    }
    return 0;
}




SOLUTION OF URI 1144


//  1144   (Mahmud_Jamil) BRUR
//  Logical Sequence




#include <stdio.h>
int main()
{
    int a,b,c,d,e,f;
    scanf("%d", &a);
    for(b=1; b<=a; b++)
    {
        c=b*b;
        d=b*b*b;
        printf("%d %d %d\n",b,c,d);
        e=c+1;
        f=d+1;
        printf("%d %d %d\n",b,e,f);
    }
    return 0;
}





SOLUTION OF URI 1142


// 1142    (Mahmud_Jamil) BRUR
//  PUM






#include<stdio.h>
int main(){

        int N,i,j;

        scanf("%d",&N);
        for(i=1;i<=(4*N-1);i+=4) {
            for(j=i;j<=i+2;j++) {
                printf("%d ",j);
            }
            printf("PUM\n");
        }

}





SOLUTION OF URI 1134


//  1134   (Mahmud_Jamil) BRUR
//   Type of Fuel



#include <stdio.h>
int main()
{
    int a, x=0, y=0, z=0;
    while(1)
    {
        scanf("%d", &a);
        if(a==4)
            break;
        else
        {
            if(a==1) x++;
            else if(a==2) y++;
            else if(a==3) z++;
            else continue;
        }
    }
    printf("MUITO OBRIGADO\n");
    printf("Alcool: %d\n",x);
    printf("Gasolina: %d\n",y);
    printf("Diesel: %d\n",z);
    return 0;
}




SOLUTION OF URI 1133


//  1133    (Mahmud_Jamil) BRUR
//   Rest of a Division



#include<stdio.h>
int main()
{
    int X,Y,i;
    scanf("%d%d",&X,&Y);
    if(X>Y) {
         for (i=Y+1;i<X;i++) {
                if(i%5==2 || i%5==3) {
                    printf("%d\n",i);
                }
            }
    }else if(X<Y){
        for (i=X+1;i<Y;i++) {
                if(i%5==2 || i%5==3) {
                     printf("%d\n",i);
                }
            }
    }
    return 0;

}




Sunday, June 19, 2016

SOLUTION OF URI 1132


//  1132  (Mahmud_Jamil) BRUR
// 
Multiples of 13




 #include<stdio.h>
int main()
{
int x,y,i,sum=0;
scanf("%d %d",&x,&y);
if(y>x){
for(i=x;i<=y;i++){
    if(i%13!=0)
        sum=sum+i;
    }
}
else if(x>y){
    for(i=y;i<=x;i++){
        if(i%13!=0)
        sum=sum+i;
        }
    }
    printf("%d\n",sum);
return 0;
}




SOLUTION OF URI 1131



// 1131  (Mahmud_Jamil) BRUR
// 
Grenais




#include <stdio.h>
int main()
{
    int a,b,c=0,d=0,e=0,f,g,h,i,j=0,k=0,l=0;
    while(1)
    {
        scanf ("%d%d", &a, &b);
        if(a>b) l++;
        if(a<b) k++;
        if(a==b) j++;
        c+=a;
        d+=b;
        e++;
        printf("Novo grenal (1-sim 2-nao)\n");
        scanf("%d",&f);
        if(f==1)
            continue;
        if(f==2)
            break;
    }
    printf("%d grenais\n",e);
    printf("Inter:%d\n",l);
    printf("Gremio:%d\n",k);
    printf("Empates:%d\n",j);
    if(l>k)
        printf("Inter venceu mais\n");
    if(l<k)
        printf("Gremio venceu mais\n");
    if(k==l)
        printf("Nao houve vencedor\n");
    return 0;
}







SOLUTION OF URI 1118



//  1118   (Mahmud_Jamil) BRUR
//  Several Scores with Validation




#include <stdio.h>
int main()
{
    double a,b,c,d,e,f,g,h=1,x=1,y=1,z=1;
    for(h=1;;h=1,x=1,y=1,z=1)
    {
        scanf("%lf",&a);
        if(a<0 || a>10)
        {
            printf("nota invalida\n");
            continue;
        }
        while(x==1)
        {
            scanf("%lf",&b);
            if(b<0 || b>10)
            {
                printf("nota invalida\n");
                continue;
            }
            x+=2;
        }
        c=(a+b)/2.0;
        printf("media = %.2lf\n",c);
        printf("novo calculo (1-sim 2-nao)\n");
        while(y==1)
        {
            scanf("%lf", &g);
            if(g<1 || g>2)
            {
                printf("novo calculo (1-sim 2-nao)\n");
                continue;
            }
            y+=2;
        }
        if(g==2)
            break;
    }
    return 0;
}








SOLUTION OF URI 1117


// 1117   (Mahmud_Jamil) BRUR
// 
Score Validation





#include <stdio.h>
int main()
{
    double a,b,c=0,d=0;
    while(1)
    {
        if(d==2)
            break;
        scanf("%lf", &a);
        if(a>=0 && a<=10)
        {
            d++;
            c+=a;
        }
        else
            printf("nota invalida\n");
    }
    b=c/2.00;
    printf("media = %.2lf\n", b);
    return 0;
}






SOLUTION OF URI 1116


//  1116   (Mahmud_Jamil) BRUR
//  Dividing X by Y





#include <stdio.h>
int main()
{
    int a,b,c,d;
    double e;
    scanf("%d",&a);
    for(b=1;b<=a;b++)
    {
        scanf("%d%d",&c,&d);
        if(d==0)
            printf("divisao impossivel\n");
        else
        {
            e=c/(d*1.00);
            printf("%.1lf\n",e);
        }
    }
    return 0;
}





SOLUTION OF URI 1115


// 1115   (Mahmud_Jamil) BRUR
// 
Quadrant





#include<stdio.h>
int main()
{
    int x,y,i;
    for(i=0;i<100;i++){
        scanf("%d%d",&x,&y);
        if(x==0 || y==0)
                break;
        else if(x>0 && y>0)
                printf("primeiro\n");
        else if(x>0 && y<0)
                printf("quarto\n");
        else if(x<0 && y<0)
                printf("terceiro\n");
        else if(x<0 && y>0)
                printf("segundo\n");

}
return 0;
}



SOLUTION OF URI 1101


//  1101   (Mahmud_Jamil) BRUR
//   Sequence of Numbers and Sum





#include <stdio.h>
int main()
{
    int a,b,c,d=0;
    while(1)
    {
        scanf("%d%d", &a, &b);
        if(a<=0 || b<=0)
            break;
        else
        {
            d=0;
            if(a<b)
            {
                for(c=a; c<=b; c++)
                {
                    printf("%d ",c);
                    d+=c;
                }
                printf("Sum=%d\n",d);
            }
            else if(a>b)
            {
                for(c=b; c<=a; c++)
                {
                    printf("%d ",c);
                    d+=c;
                }
                printf("Sum=%d\n",d);
            }
        }
    }
    return 0;
}




SOLUTION OF URI 1099


//  1099    (Mahmud_Jamil) BRUR
//  Sum of Consecutive Odd Numbers II





#include <stdio.h>
int main()
{
    int N,X,Y,A,b,c=0;
    scanf("%d", &N);
    for(A=1;A<=N;A++)
    {
        scanf("%d%d",&X,&Y);
        if(X==Y)
        {
            c=0;
            printf("%d\n",c);
        }
        else if(X<Y)
        {
            for(b=X+1,c=0;b<Y;b++)
            {
                if(b%2==1||b%2==-1)
                    c+=b;
            }
            printf("%d\n",c);
        }
        else
        {
            for(b=Y+1,c=0;b<X;b++)
            {
                if(b%2==1||b%2==-1)
                    c+=b;
            }
            printf("%d\n",c);
        }
    }
    return 0;
}








SOLUTION OF URI 1098


// 1098   (Mahmud_Jamil) BRUR
//  Sequence IJ 4




#include <stdio.h>
int main()
{
    double a,b,c=1,d=3,e,f;
    int x;
    for(a=0;a<=1.9;a=a+.2)
    {
        for(b=1.0;b<=3.0;b++)
        {
            e=b+a;
            if(a==0.0||a==1.0)
                printf("I=%.0lf J=%.0lf",a,e);
            else if(e==3.0||e==4.0||e==5.0)
            printf("I=%.0lf J=%.0lf",a,e);
            else
            printf("I=%.1lf J=%.1lf",a,e);
            printf("\n");
        }
    }
    for(x=3;x<=5;x++)
        printf("I=2 J=%d\n",x);
    return 0;
}




SOLUTION OF URI 1094


//  1094   (Mahmud_Jamil) BRUR
//  Experiments



#include<stdio.h>
int main()
{
    int i,n,x;
    long int t_c=0,t_r=0,t_s=0,sum=0;
    char ch;
    float c,r,s;
    scanf("%d",&n);
    for(i=1;i<=n;i++){
        scanf("%d %c",&x,&ch);
        sum+=x;
        if(ch=='C')
            t_c+=x;
        else if(ch=='R')
            t_r+=x;
        else if(ch=='S')
            t_s+=x;
    }
    c=(float)t_c/(float)sum*100.00;
    r=(float)t_r/(float)sum*100.00;
    s=(float)t_s/(float)sum*100.00;
    printf("Total: %ld cobaias\nTotal de coelhos: %d\nTotal de ratos: %d\nTotal de sapos: %d\nPercentual de coelhos: %.2f %c\nPercentual de ratos: %.2f %c\nPercentual de sapos: %.2f %c\n",sum,t_c,t_r,t_s,c,'%',r,'%',s,'%');
    return 0;
}






SOLUTION OF URI 1080


//  1080   (Mahmud_Jamil) BRUR
//  Highest and Position


#include<stdio.h>
int main()
{
    int i,in,m=0,p;
    for(i=1;i<=100;i++){
        scanf("%d",&in);
        if(m<in){
            m=in;
            p=i;
        }
    }
    printf("%d\n%d\n",m,p);
    return 0;
}








SOLUTION OF URI 1079


//  1079   (Mahmud_Jamil) BRUR
//  Weighted Averages


#include<stdio.h>
int main()
{
    float a,b,c,total,ave;
    int i,n;
    scanf("%d",&n);
    for(i=1;i<=n;i++){
        scanf("%f%f%f",&a,&b,&c);
        total=a*2.0+b*3.0+c*5.0;
        ave=total/10.0;
        printf("%.1f\n",ave);
    }
    return 0;
}







Wednesday, June 15, 2016

SOLUTION OF URI 1074


//  1074  (Mahmud_Jamil) BRUR
// 
Even or Odd




#include<stdio.h>
int main()
{
    long int i,N,X;
    scanf("%ld",&N);
    for(i=1;i<=N;i++){
        scanf("%d",&X);
        if(X==0)
            printf("NULL\n");
        if(X%2==0 && X>0)
            printf("EVEN POSITIVE\n");
        if(X%2==0 && X<0)
            printf("EVEN NEGATIVE\n");
        if(X%2==1 && X>0)
            printf("ODD POSITIVE\n");
        if(X%2==-1 && X<0)
        printf("ODD NEGATIVE\n");
    }
    return 0;
}



SOLUTION OF URI 1072


//  1072  (Mahmud_Jamil) BRUR
//  Interval 2



#include<stdio.h>
int main()
{
    long long int i,n,input,in=0,out=0;
    scanf("%lld",&n);
    for(i=1;i<=n;i++){
        scanf("%lld",&input);
        if(input>=10 && input<=20)
            in++;
        else
            out++;
    }
    printf("%lld in\n%lld out\n",in,out);
    return 0;
}



SOLUTION OF URI 1071


// 1071  (Mahmud_Jamil) BRUR
//  Sum of Consecutive Odd Numbers I




 #include<stdio.h>
int main()
{
    int i,a,b,c,sum;
    while(scanf("%d%d",&a,&b)==2){
        sum=0;
        if(a>b){
            c=a;
            a=b;
            b=c;
        }
        if(a%2!=0){
        for(i=a+2;i<b;i++){
            if(i%2!=0)
                sum+=i;
            }
        }
        else{
            for(i=a+1;i<b;i++){
            if(i%2!=0)
                sum+=i;
            }
        }
        printf("%d\n",sum);
    }
    return 0;
}




SOLUTION OF URI 1066


//  1066  (Mahmud_Jamil) BRUR
//    question of  1066 Even, Odd, Positive and N...



#include<stdio.h>
int main()
{
    int i,n,even=0,odd=0,pos=0,neg=0;
    for(i=1;i<=5;i++){
        scanf("%d",&n);
        if(n%2==0)
            even++;
        else
            odd++;
        if(n>0)
            pos++;
        else if(n<0)
            neg++;
    }
    printf("%d valor(es) par(es)\n",even);
    printf("%d valor(es) impar(es)\n",odd);
    printf("%d valor(es) positivo(s)\n",pos);
    printf("%d valor(es) negativo(s)\n",neg);
    return 0;
}


SOLUTION OF URI 1065


//  1065  (Mahmud_Jamil) BRUR
// 
  question of  1065 Even Between five Numbers



#include <stdio.h>
 int main()
 {
     int i, sum=0;
     int n;
     for(i=1; i<=5; i++){
            scanf("%d",&n);
     if(n%2==0){
            sum+=1;
       }
   }
      printf("%d valores pares\n",sum);

    return 0;
}




SOLUTION OF URI 1064


//  1064   (Mahmud_Jamil) BRUR
//    question of  1064 Positives and Average



#include<stdio.h>
int main()
{
    int i,count=0;
    float n,sum=0.0,average;
    for(i=1;i<=6;i++){
        scanf("%f",&n);
        if(n>0){
            sum+=n;
            count++;
        }
        average=sum/(float)count;
    }
    printf("%d valores positivos\n",count);
    printf("%.1lf\n",average);
    return 0;
}



SOLUTION OF URI 1061


//  1061  (Mahmud_Jamil) BRUR
//     question of  1061 Event Time



#include <stdio.h>
int main()
{
    char a[4], b[2],c[2],d[2],e[2],f[4];
    int i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,h[5];
    scanf("%s%d", a,&i);
    scanf("%d%s%d%s%d", &j,&b,&k,&c,&l);
    scanf("%s%d", &f,&p);
    scanf("%d%s%d%s%d", &q, &d,&r,&e,&s);
    m=60-l+s;
    n=(60-k-1+r)*60;
    t=(24-1-j+q)*3600;
    u=(p-i-1)*86400;
    v=m+n+t+u;

    h[0]=v/86400;
    printf("%d dia(s)\n", h[0]);

    h[0]=v%86400;
    h[1]=h[0]/3600;
    printf("%d hora(s)\n", h[1]);

    h[1]=h[0]%3600;
    h[2]=h[1]/60;
    printf("%d minuto(s)\n", h[2]);

    h[2]=h[1]%60;
    printf("%d segundo(s)\n", h[2]);
    return 0;
}




SOLUTION OF URI 1060


//  1060  (Mahmud_Jamil) BRUR
//
  question of  1060 Positive Numbers





#include <stdio.h>
int main()
{
    int i, sum=0;
    float n;
    for(i=1; i<=6; i++){
            scanf("%f",&n);
    if(n>0){
            sum+=1;
    }
    }
    printf("%d valores positivos\n",sum);


    return 0;
}



SOLUTION OF URI 1052


//  1052   (Mahmud_Jamil) BRUR
//    question of  1052 Month



#include <stdio.h>
 int main()
 {
     int a;
     scanf("%d",&a);
     if(a==1) printf("January\n");
     if(a==2) printf("February\n");
     if(a==3) printf("March\n");
     if(a==4) printf("April\n");
     if(a==5) printf("May\n");
     if(a==6) printf("June\n");
     if(a==7) printf("July\n");
     if(a==8) printf("August\n");
     if(a==9) printf("September\n");
     if(a==10) printf("October\n");
     if(a==11) printf("November\n");
     if(a==12) printf("December\n");

     return 0;
 }



SOLUTION OF URI 1051


 //  1051  (Mahmud_Jamil) BRUR
//  
  question of  1051 Taxes



#include <stdio.h>
int main()
{
   double a,b;
    scanf("%lf", &a);
    if(a>=0 && a<=2000)
        printf("Isento\n");
    else if(a>=2000.01 && a<=3000)
    {
        a-=2000;
        b= a*.08;
        printf("R$ %.2lf\n",b);
    }
    else if(a>=3000.01 && a<=4500)
    {
        a-=3000;
        b= a*.18+80;
        printf("R$ %.2lf\n",b);
    }
    else
    {
        a-=4500;
        b= a*.28+350;
        printf("R$ %.2lf\n",b);
    }
    return 0;
}



Sunday, June 12, 2016

SOLUTION OF URI 1050


// 1050   (Mahmud_Jamil) BRUR
//    question of  1050 DDD



#include <stdio.h>
int main()
{
    int d;
    scanf("%d", &d);
    if (d == 61)
        printf("Brasilia\n");
    else if (d == 71)
        printf("Salvador\n");
    else if (d == 11)
        printf("Sao Paulo\n");
    else if (d == 21)
        printf("Rio de Janeiro\n");
    else if (d == 32)
        printf("Juiz de Fora\n");
    else if (d == 19)
        printf("Campinas\n");
    else if (d == 27)
        printf("Vitoria\n");
    else if (d == 31)
        printf("Belo Horizonte\n");
    else
        printf("DDD nao cadastrado\n");
}





SOLUTION OF URI 1049


// 1049   (Mahmud_Jamil) BRUR
//
  question of  1049 Animal




#include <stdio.h>
#include <string.h>
int main()
{
    char c1[]="vertebrado", c11[22]="ave", c12[]="mamifero";
    char c111[]="carnivoro", c112[]="onivoro", c124[]="herbivoro";
    char a1[]="aguia", a2[]="pomba", a3[]="homem", a4[]="vaca";
    char c2[]="invertebrado", c21[]="inseto", c22[]="anelideo";
    char c211[]="hematofago", a5[]="pulga", a6[]="lagarta";
    char a7[]="sanguessuga", a8[]="minhoca";
    char a[22], b[22], c[22];
    scanf("%s", a);
    if(0==strcmp(a,c1))
    {
        scanf("%s",b);
        if(0==strcmp(b,c11))
        {
            scanf("%s",c);
            if(0==strcmp(c,c111))
                printf("%s\n",a1);
            else if(0==strcmp(c,c112))
                printf("%s\n",a2);
        }
        if(0==strcmp(b,c12))
        {
            scanf("%s",&c);
            if(0==strcmp(c,c112))
                printf("%s\n",a3);
            else if(0==strcmp(c,c124))
                printf("%s\n",a4);
        }
    }
    else if(0==strcmp(a,c2))
    {
        scanf("%s",b);
        if(0==strcmp(b,c21))
        {
            scanf("%s",&c);
            if(0==strcmp(c,c211))
                printf("%s\n",a5);
            else if(0==strcmp(c,c124))
                printf("%s\n",a6);
        }
        if(0==strcmp(b,c22))
        {
            scanf("%s",&c);
            if(0==strcmp(c,c211))
                printf("%s\n",a7);
            else if(0==strcmp(c,c112))
                printf("%s\n",a8);
        }
    }
    return 0;
}




SOLUTION OF URI 1048


// 1048  (Mahmud_Jamil) BRUR
//   question of  1048 Salary Increase



#include<stdio.h>
int main()
{
    float a,b,c;
    int d;
    while(scanf("%f",&a)==1){
        if(a<=400.00){
            d=15;
            b=a*15.00/100.00;
        }
        else if(a>400.00 && a<=800.00){
            d=12;
            b=a*12.00/100.00;
        }
        else if(a>800.00 && a<=1200.00){
            d=10;
            b=a*10.00/100.00;
        }
        else if(a>1200.00 && a<=2000.00){
            d=7;
            b=a*7.00/100.00;
        }
        else{
            d=4;
            b=a*4.00/100.00;
    }
    c=a+b;
    printf("Novo salario: %.2f\nReajuste ganho: %.2f\nEm percentual: %d %c\n",c,b,d,'%');
    }
    return 0;
}