Hi, Welcome to my Blog. Before seeing the code solution make sure that you have tried enough. Don’t copy- paste the whole code. Find out the logic. If you face in trouble, just inform me in comment. Happy Coding ...!
Monday, October 29, 2018
Friday, October 26, 2018
Uri 1149 Solution in C | Summing Consecutive Integers
/*Before seeing the code solution make sure that you have tried enough. Don’t copy- paste the whole code. Find out the logic. If you face any trouble, just inform me in comment.*/
#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;
}
//Happy_Coding
#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;
}
//Happy_Coding
Uri 1146 solution in C | Growing Sequences
/*Before seeing the code solution make sure that you have tried enough. Don’t copy- paste the whole code. Find out the logic. If you face any trouble, just inform me in comment.*/
#include<stdio.h>
main()
{
int x,i;
while(1)
{
scanf("%d",&x);
if(x==0)
break;
for(i=1;i<x;i++)
{
printf("%d ",i);
}
printf("%d\n",x);
}
return 0;
}
//Happy_Coding
#include<stdio.h>
main()
{
int x,i;
while(1)
{
scanf("%d",&x);
if(x==0)
break;
for(i=1;i<x;i++)
{
printf("%d ",i);
}
printf("%d\n",x);
}
return 0;
}
Uri 1145 solution in C | Logical Sequence 2
/*Before seeing the code solution make sure that you have tried enough. Don’t copy- paste the whole code. Find out the logic. If you face any trouble, just inform me in comment.*/
#include<stdio.h>
int main()
{
int n,a,i,j,k,l,m=1;
scanf("%d %d",&a,&n);
k = n / a;
l=a;
for(i = 1;i <=k;i++)
{
printf("%d",m);
for(j=m+1;j<=l;j++){
printf(" %d",j);
}
printf("\n");
m += a;
l += a;
}
return 0;
}
//Happy_Coding
#include<stdio.h>
int main()
{
int n,a,i,j,k,l,m=1;
scanf("%d %d",&a,&n);
k = n / a;
l=a;
for(i = 1;i <=k;i++)
{
printf("%d",m);
for(j=m+1;j<=l;j++){
printf(" %d",j);
}
printf("\n");
m += a;
l += a;
}
return 0;
}
Uri 1144 solution in C | Logical Sequence
/*Before seeing the code solution make sure that you have tried enough. Don’t copy- paste the whole code. Find out the logic. If you face any trouble, just inform me in comment.*/
#include<stdio.h>
main()
{
int i,a,b,c,n,x,y,z;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
a=i;
b=i*i;
c=i*i*i;
x=b+1;
y=c+1;
printf("%d %d %d\n%d %d %d\n",i,b,c,a,x,y);
}
return 0;
}
//Happy_Coding
#include<stdio.h>
main()
{
int i,a,b,c,n,x,y,z;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
a=i;
b=i*i;
c=i*i*i;
x=b+1;
y=c+1;
printf("%d %d %d\n%d %d %d\n",i,b,c,a,x,y);
}
return 0;
}
Uri 1143 solution in C | Squared and Cubic
/*Before seeing the code solution make sure that you have tried enough. Don’t copy- paste the whole code. Find out the logic. If you face any trouble, just inform me in comment.*/
#include<stdio.h>
main()
{
int i,j,k,n;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
j=i*i;
k=i*i*i;
printf("%d %d %d\n",i,j,k);
}
return 0;
}
//Happy_Coding
#include<stdio.h>
main()
{
int i,j,k,n;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
j=i*i;
k=i*i*i;
printf("%d %d %d\n",i,j,k);
}
return 0;
}
//Happy_Coding
Uri 1142 solution in C | PUM
/*Before seeing the code solution make sure that you have tried enough. Don’t copy- paste the whole code. Find out the logic. If you face any trouble, just inform me in comment.*/
#include <stdio.h>
int main()
{
int N, a,b,c=1,d=4;
scanf("%d", &N);
for(a=1;a<=N;a++)
{
for(b=c;b<=d;b++)
{
if(b%4==0)
printf("PUM\n");
else
printf ("%d ",b);
}
c+=4; d+=4;
}
return 0;
}
//Happy_Coding
#include <stdio.h>
int main()
{
int N, a,b,c=1,d=4;
scanf("%d", &N);
for(a=1;a<=N;a++)
{
for(b=c;b<=d;b++)
{
if(b%4==0)
printf("PUM\n");
else
printf ("%d ",b);
}
c+=4; d+=4;
}
return 0;
}
Uri 1134 solution in C | Type of Fuel
/*Before seeing the code solution make sure that you have tried enough. Don’t copy- paste the whole code. Find out the logic. If you face any trouble, just inform me in comment.*/
#include<stdio.h>
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\nAlcool: %d\nGasolina: %d\nDiesel: %d\n",x,y,z);
return 0;
}
//Happy_Coding
#include<stdio.h>
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\nAlcool: %d\nGasolina: %d\nDiesel: %d\n",x,y,z);
return 0;
}
Uri 1133 solution in C | Rest of a Division
/*Before seeing the code solution make sure that you have tried enough. Don’t copy- paste the whole code. Find out the logic. If you face any trouble, just inform me in comment.*/
#include<stdio.h>
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(y>x)
{
for(i=x+1;i<y;i++)
{
if(i%5==2||i%5==3)
printf("%d\n",i);
}
}
return 0;
}
//Happy_Coding
#include<stdio.h>
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(y>x)
{
for(i=x+1;i<y;i++)
{
if(i%5==2||i%5==3)
printf("%d\n",i);
}
}
return 0;
}
Uri 1132 solution in C | Multiples of 13
/*Before seeing the code solution make sure that you have tried enough. Don’t copy- paste the whole code. Find out the logic. If you face any trouble, just inform me in comment.*/
#include<stdio.h>
main()
{
int x,y,i,sum=0;
scanf("%d%d",&x,&y);
if(x>y)
{
for(i=y;i<=x;i++)
{
if(i%13!=0)
{
sum=sum+i;
}
}
}
else if(y>x)
{
for(i=x;i<=y;i++)
{
if(i%13!=0)
{
sum=sum+i;
}
}
}
printf("%d\n",sum);
return 0;
}
//Happy_Coding
#include<stdio.h>
main()
{
int x,y,i,sum=0;
scanf("%d%d",&x,&y);
if(x>y)
{
for(i=y;i<=x;i++)
{
if(i%13!=0)
{
sum=sum+i;
}
}
}
else if(y>x)
{
for(i=x;i<=y;i++)
{
if(i%13!=0)
{
sum=sum+i;
}
}
}
printf("%d\n",sum);
return 0;
}
Uri 1118 solution in C | Several Scores with Validation
/*Before seeing the code solution make sure that you have tried enough. Don’t copy- paste the whole code. Find out the logic. If you face any trouble, just inform me in comment.*/
#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;
}
//Happy_Coding
#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;
}
//Happy_Coding
Uri 1117 solution in C | Score Validation
/*Before seeing the code solution make sure that you have tried enough. Don’t copy- paste the whole code. Find out the logic. If you face any trouble, just inform me in comment.*/
#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;
}
//Happy_Coding
#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;
}
//Happy_Coding
Uri 1116 solution in C | Dividing X by Y
/*Before seeing the code solution make sure that you have tried enough. Don’t copy- paste the whole code. Find out the logic. If you face any trouble, just inform me in comment.*/
#include<stdio.h>
main()
{
int x,y,n,i;
double t;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
scanf("%d%d",&x,&y);
if(y==0)
{
printf("divisao impossivel\n");
}
else
{
t=x/(y*1.00);
printf("%.1lf\n",t);
}
}
return 0;
}
//Happy_Coding
#include<stdio.h>
main()
{
int x,y,n,i;
double t;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
scanf("%d%d",&x,&y);
if(y==0)
{
printf("divisao impossivel\n");
}
else
{
t=x/(y*1.00);
printf("%.1lf\n",t);
}
}
return 0;
}
//Happy_Coding
Uri 1115 solution in C | Quadrant
/*Before seeing the code solution make sure that you have tried enough. Don’t copy- paste the whole code. Find out the logic. If you face any trouble, just inform me in comment.*/
#include<stdio.h>
main()
{
int m,n;
while(1)
{
scanf("%d%d",&m,&n);
if(m==0||n==0)
break;
else if(m>0&&n>0)
{
printf("primeiro\n");
}
else if(m>0&&n<0)
{
printf("quarto\n");
}
else if(m<0&&n>0)
{
printf("segundo\n");
}
else if(m<0&&n<0)
{
printf("terceiro\n");
}
}
return 0;
}
//Happy_Coding
#include<stdio.h>
main()
{
int m,n;
while(1)
{
scanf("%d%d",&m,&n);
if(m==0||n==0)
break;
else if(m>0&&n>0)
{
printf("primeiro\n");
}
else if(m>0&&n<0)
{
printf("quarto\n");
}
else if(m<0&&n>0)
{
printf("segundo\n");
}
else if(m<0&&n<0)
{
printf("terceiro\n");
}
}
return 0;
}
//Happy_Coding
Uri 1114 soution in C | Fixed Password
/*Before seeing the code solution make sure that you have tried enough. Don’t copy- paste the whole code. Find out the logic. If you face any trouble, just inform me in comment.*/
#include<stdio.h>
main()
{
int i;
while(1)
{
scanf("%d",&i);
if(i==2002)
{
printf("Acesso Permitido\n");
break;
}
else if(i!=2002)
{
printf("Senha Invalida\n");
}
}
return 0;
}
//Happy_Coding
#include<stdio.h>
main()
{
int i;
while(1)
{
scanf("%d",&i);
if(i==2002)
{
printf("Acesso Permitido\n");
break;
}
else if(i!=2002)
{
printf("Senha Invalida\n");
}
}
return 0;
}
//Happy_Coding
Uri 1113 solution in C | Ascending and Descending
/*Before seeing the code solution make sure that you have tried enough. Don’t copy- paste the whole code. Find out the logic. If you face any trouble, just inform me in comment.*/
#include<stdio.h>
main()
{
int i,j;
while(1)
{
scanf("%d%d",&i,&j);
if(i==j)
break;
else if(i>j)
{
printf("Decrescente\n");
}
else if(j>i)
{
printf("Crescente\n");
}
}
return 0;
}
//Happy_Coding
#include<stdio.h>
main()
{
int i,j;
while(1)
{
scanf("%d%d",&i,&j);
if(i==j)
break;
else if(i>j)
{
printf("Decrescente\n");
}
else if(j>i)
{
printf("Crescente\n");
}
}
return 0;
}
//Happy_Coding
Uri 1101 solution in C | Sequence of Numbers and Sum
/*Before seeing the code solution make sure that you have tried enough. Don’t copy- paste the whole code. Find out the logic. If you face any trouble, just inform me in comment.*/
#include<stdio.h>
main()
{
int m,n,i,j=0;
while(1)
{
scanf("%d%d",&m,&n);
if(m<=0||n<=0)
{
break;
}
else if(m>n)
{
for(i=n,j=0;i<=m;i++)
{
j=j+i;
printf("%d ",i);
}
printf("Sum=%d\n",j);
}
else if(n>m)
{
for(i=m,j=0;i<=n;i++)
{
j=j+i;
printf("%d ",i);
}
printf("Sum=%d\n",j);
}
}
return 0;
}
//Happy_Coding
#include<stdio.h>
main()
{
int m,n,i,j=0;
while(1)
{
scanf("%d%d",&m,&n);
if(m<=0||n<=0)
{
break;
}
else if(m>n)
{
for(i=n,j=0;i<=m;i++)
{
j=j+i;
printf("%d ",i);
}
printf("Sum=%d\n",j);
}
else if(n>m)
{
for(i=m,j=0;i<=n;i++)
{
j=j+i;
printf("%d ",i);
}
printf("Sum=%d\n",j);
}
}
return 0;
}
//Happy_Coding
Uri 1099 solution in C | Sum of Consecutive Odd Numbers II
/*Before seeing the code solution make sure that you have tried enough. Don’t copy- paste the whole code. Find out the logic. If you face any trouble, just inform me in comment.*/
#include<stdio.h>
main()
{
int i,j,k,l=0,x,y,n;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
scanf("%d%d",&x,&y);
if(x>y)
{
for(j=y+1,l=0;j<x;j++)
{
if(j%2!=0)
{
l=l+j;
}
}
printf("%d\n",l);
}
else
{
for(j=x+1,l=0;j<y;j++)
{
if(j%2!=0)
{
l=l+j;
}
}
printf("%d\n",l);
}
}
return 0;
}
//Happy_Coding
#include<stdio.h>
main()
{
int i,j,k,l=0,x,y,n;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
scanf("%d%d",&x,&y);
if(x>y)
{
for(j=y+1,l=0;j<x;j++)
{
if(j%2!=0)
{
l=l+j;
}
}
printf("%d\n",l);
}
else
{
for(j=x+1,l=0;j<y;j++)
{
if(j%2!=0)
{
l=l+j;
}
}
printf("%d\n",l);
}
}
return 0;
}
Uri 1098 solution in C | Sequence IJ 4
/*Before seeing the code solution make sure that you have tried enough. Don’t copy- paste the whole code. Find out the logic. If you face any trouble, just inform me in comment.*/
#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;
}
//Happy_Coding
#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;
}
Uri 1097 solution in C | Sequence IJ 3
/*Before seeing the code solution make sure that you have tried enough. Don’t copy- paste the whole code. Find out the logic. If you face any trouble, just inform me in comment.*/
#include<stdio.h>
main()
{
int i,j,k=7;
for(i=1;i<=9;i=i+2)
{
for(j=k;j>=k-2;j--)
{
printf("I=%d J=%d\n",i,j);
}
k+=2;
}
return 0;
}
//Happy_Coding
#include<stdio.h>
main()
{
int i,j,k=7;
for(i=1;i<=9;i=i+2)
{
for(j=k;j>=k-2;j--)
{
printf("I=%d J=%d\n",i,j);
}
k+=2;
}
return 0;
}
//Happy_Coding
Uri 1096 solution in C | Sequence IJ 2
/*Before seeing the code solution make sure that you have tried enough. Don’t copy- paste the whole code. Find out the logic. If you face any trouble, just inform me in comment.*/
#include<stdio.h>
main()
{
int i,j;
for(i=1;i<=9;i=i+2)
{
for(j=7;j>=5;j--)
{
printf("I=%d J=%d\n",i,j);
}
}
return 0;
}
//Happy_Coding
#include<stdio.h>
main()
{
int i,j;
for(i=1;i<=9;i=i+2)
{
for(j=7;j>=5;j--)
{
printf("I=%d J=%d\n",i,j);
}
}
return 0;
}
//Happy_Coding
Uri 1095 solution in C | Sequence IJ 1
/*Before seeing the code solution make sure that you have tried enough. Don’t copy- paste the whole code. Find out the logic. If you face any trouble, just inform me in comment.*/
#include<stdio.h>
main()
{
int i,j;
for(i=1,j=60;j>=0;i=i+3,j=j-5)
{
printf("I=%d J=%d\n",i,j);
}
return 0;
}
//Happy_Coding
#include<stdio.h>
main()
{
int i,j;
for(i=1,j=60;j>=0;i=i+3,j=j-5)
{
printf("I=%d J=%d\n",i,j);
}
return 0;
}
Uri 1094 Solution in C | Experiments
/*Before seeing the code solution make sure that you have tried enough. Don’t copy- paste the whole code. Find out the logic. If you face any trouble, just inform me in comment.*/
#include <stdio.h>
int main()
{
int a,b,c,d=0,e=0,f=0,g;
double x,y,z;
char m[2];
scanf("%d", &a);
for(b=1; b<=a; b++)
{
scanf("%d%s",&c,&m);
if(m[0]=='C') d+=c;
else if(m[0]=='R') e+=c;
else if(m[0]=='S') f+=c;
}
g=d+e+f;
x=(d/(g*1.0))*100.00;
y=(e/(g*1.0))*100.00;
z=(f/(g*1.0))*100.00;
printf("Total: %d cobaias\n",g);
printf("Total de coelhos: %d\n",d);
printf("Total de ratos: %d\n",e);
printf("Total de sapos: %d\n",f);
printf("Percentual de coelhos: %.2lf %%\n",x);
printf("Percentual de ratos: %.2lf %\n",y);
printf("Percentual de sapos: %.2lf %\n",z);
return 0;
}
//Happy_Coding
#include <stdio.h>
int main()
{
int a,b,c,d=0,e=0,f=0,g;
double x,y,z;
char m[2];
scanf("%d", &a);
for(b=1; b<=a; b++)
{
scanf("%d%s",&c,&m);
if(m[0]=='C') d+=c;
else if(m[0]=='R') e+=c;
else if(m[0]=='S') f+=c;
}
g=d+e+f;
x=(d/(g*1.0))*100.00;
y=(e/(g*1.0))*100.00;
z=(f/(g*1.0))*100.00;
printf("Total: %d cobaias\n",g);
printf("Total de coelhos: %d\n",d);
printf("Total de ratos: %d\n",e);
printf("Total de sapos: %d\n",f);
printf("Percentual de coelhos: %.2lf %%\n",x);
printf("Percentual de ratos: %.2lf %\n",y);
printf("Percentual de sapos: %.2lf %\n",z);
return 0;
}
//Happy_Coding
Uri 1080 solution in C | Highest and Position
/*Before seeing the code solution make sure that you have tried enough. Don’t copy- paste the whole code. Find out the logic. If you face any trouble, just inform me in comment.*/
#include<stdio.h>
main()
{
int n=0,i,a,max=0,j;
for(i=1;i<=100;i++)
{
scanf("%d",&a);
n++;
if(a>max)
{
max=a;
j=n;
}
}
printf("%d\n%d\n",max,j);
return 0;
}
//Happy_Coding
#include<stdio.h>
main()
{
int n=0,i,a,max=0,j;
for(i=1;i<=100;i++)
{
scanf("%d",&a);
n++;
if(a>max)
{
max=a;
j=n;
}
}
printf("%d\n%d\n",max,j);
return 0;
}
//Happy_Coding
Uri 1079 solution in C | Weighted Averages
/*Before seeing the code solution make sure that you have tried enough. Don’t copy- paste the whole code. Find out the logic. If you face any trouble, just inform me in comment.*/
#include<stdio.h>
main()
{
int n,i;
double k,m,b,s;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
scanf("%lf%lf%lf",&k,&m,&b);
s=((k*2)+(m*3)+(b*5))/10;
printf("%.1lf\n",s);
}
return 0;
}
//Happy_Coding
#include<stdio.h>
main()
{
int n,i;
double k,m,b,s;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
scanf("%lf%lf%lf",&k,&m,&b);
s=((k*2)+(m*3)+(b*5))/10;
printf("%.1lf\n",s);
}
return 0;
}
Uri 1078 solution in C | Multiplication Table
/*Before seeing the code solution make sure that you have tried enough. Don’t copy- paste the whole code. Find out the logic. If you face any trouble, just inform me in comment.*/
#include<stdio.h>
main()
{
int n,i;
scanf("%d",&n);
for(i=1;i<=10;i++)
{
printf("%d x %d = %d\n",i,n,i*n);
}
return 0;
}
//Happy_Coding
#include<stdio.h>
main()
{
int n,i;
scanf("%d",&n);
for(i=1;i<=10;i++)
{
printf("%d x %d = %d\n",i,n,i*n);
}
return 0;
}
Uri 1075 solution in C | Remaining 2
/*Before seeing the code solution make sure that you have tried enough. Don’t copy- paste the whole code. Find out the logic. If you face any trouble, just inform me in comment.*/
#include<stdio.h>
main()
{
int N,i;
scanf("%d",&N);
for(i=2;i<=10000;i=i+N)
{
printf("%d\n",i);
}
return 0;
}
//Happy_Coding
#include<stdio.h>
main()
{
int N,i;
scanf("%d",&N);
for(i=2;i<=10000;i=i+N)
{
printf("%d\n",i);
}
return 0;
}
//Happy_Coding
Uri 1074 solution in C | Even or Odd
/*Before seeing the code solution make sure that you have tried enough. Don’t copy- paste the whole code. Find out the logic. If you face any trouble, just inform me in comment.*/
#include <stdio.h>
int main()
{
int N,X,a;
scanf ("%d", &N);
for(a=1;a<=N;a++)
{
scanf ("%d",&X);
if(X==0)
printf("NULL\n");
else if(X<=0&&X%2==0)
printf ("EVEN NEGATIVE\n");
else if(X<=0&&X%2==-1)
printf ("ODD NEGATIVE\n");
else if(X>=0&&X%2==0)
printf ("EVEN POSITIVE\n");
else if(X>=0&&X%2==1)
printf ("ODD POSITIVE\n");
}
return 0;
}
//Happy_Coding
#include <stdio.h>
int main()
{
int N,X,a;
scanf ("%d", &N);
for(a=1;a<=N;a++)
{
scanf ("%d",&X);
if(X==0)
printf("NULL\n");
else if(X<=0&&X%2==0)
printf ("EVEN NEGATIVE\n");
else if(X<=0&&X%2==-1)
printf ("ODD NEGATIVE\n");
else if(X>=0&&X%2==0)
printf ("EVEN POSITIVE\n");
else if(X>=0&&X%2==1)
printf ("ODD POSITIVE\n");
}
return 0;
}
Uri 1073 solution in C | Even Square
/*Before seeing the code solution make sure that you have tried enough. Don’t copy- paste the whole code. Find out the logic. If you face any trouble, just inform me in comment.*/
#include<stdio.h>
main()
{
int i,n;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
if(i%2==0)
{
printf("%d^2 = %d\n",i,i*i);
}
}
return 0;
}
//Happy_Coding
#include<stdio.h>
main()
{
int i,n;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
if(i%2==0)
{
printf("%d^2 = %d\n",i,i*i);
}
}
return 0;
}
Uri 1072 solution in C | Interval 2
/*Before seeing the code solution make sure that you have tried enough. Don’t copy- paste the whole code. Find out the logic. If you face any trouble, just inform me in comment.*/
#include<stdio.h>
main()
{
int n,i,a,in=0,out=0;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&a);
if(a>=10&&a<=20)
{
in++;
}
else
out++;
}
printf("%d in\n%d out\n",in,out);
return 0;
}
//Happy_Coding
#include<stdio.h>
main()
{
int n,i,a,in=0,out=0;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&a);
if(a>=10&&a<=20)
{
in++;
}
else
out++;
}
printf("%d in\n%d out\n",in,out);
return 0;
}
Uri 1071 solution in C | Sum of Consecutive Odd Numbers I
/*Before seeing the code solution make sure that you have tried enough. Don’t copy- paste the whole code. Find out the logic. If you face any trouble, just inform me in comment.*/
#include<stdio.h>
main()
{
int a,b,i,s=0;
scanf("%d%d",&a,&b);
if(a>b)
{
for(i=b+1;i<a;i++)
{
if(i%2!=0)
{
s=s+i;
}
}
}
else
{
for(i=a+1;i<b;i++)
{
if(i%2!=0)
{
s=s+i;
}
}
}
printf("%d\n",s);
return 0;
}
//Happy_Coding
#include<stdio.h>
main()
{
int a,b,i,s=0;
scanf("%d%d",&a,&b);
if(a>b)
{
for(i=b+1;i<a;i++)
{
if(i%2!=0)
{
s=s+i;
}
}
}
else
{
for(i=a+1;i<b;i++)
{
if(i%2!=0)
{
s=s+i;
}
}
}
printf("%d\n",s);
return 0;
}
Uri 1070 solution in C | Six Odd Numbers
/*Before seeing the code solution make sure that you have tried enough. Don’t copy- paste the whole code. Find out the logic. If you face any trouble, just inform me in comment.*/
#include<stdio.h>
main()
{
int x,n,i,c=1;
scanf("%d",&n);
x=n;
while(c<=11)
{
x=x+1;
if(x%2!=0)
{
printf("%d\n",x);
}
c++;
}
return 0;
}
//Happy_Coding
#include<stdio.h>
main()
{
int x,n,i,c=1;
scanf("%d",&n);
x=n;
while(c<=11)
{
x=x+1;
if(x%2!=0)
{
printf("%d\n",x);
}
c++;
}
return 0;
}
Uri 1067 solution in C | Odd Numbers
/*Before seeing the code solution make sure that you have tried enough. Don’t copy- paste the whole code. Find out the logic. If you face any trouble, just inform me in comment.*/
#include<stdio.h>
main()
{
int x,i;
scanf("%d",&x);
for(i=1;i<=x;i++)
{
if(i%2!=0)
{
printf("%d\n",i);
}
}
return 0;
}
//Happy_Coding
#include<stdio.h>
main()
{
int x,i;
scanf("%d",&x);
for(i=1;i<=x;i++)
{
if(i%2!=0)
{
printf("%d\n",i);
}
}
return 0;
}
Uri 1066 solution in C | Even, Odd, Positive and Negative
/*Before seeing the code solution make sure that you have tried enough. Don’t copy- paste the whole code. Find out the logic. If you face any trouble, just inform me in comment.*/
#include<stdio.h>
main()
{
int n,i,p=0,ne=0,e=0,o=0;
for(i=0;i<5;i++)
{
scanf("%d",&n);
if(n%2==0)
{
e++;
}
if(n%2!=0)
{
o++;
}
if(n>0)
{
p++;
}
if(n<0)
{
ne++;
}
}
printf("%d valor(es) par(es)\n%d valor(es) impar(es)\n%d valor(es) positivo(s)\n%d valor(es) negativo(s)\n",e,o,p,ne);
return 0;
}
//Happy_Coding
#include<stdio.h>
main()
{
int n,i,p=0,ne=0,e=0,o=0;
for(i=0;i<5;i++)
{
scanf("%d",&n);
if(n%2==0)
{
e++;
}
if(n%2!=0)
{
o++;
}
if(n>0)
{
p++;
}
if(n<0)
{
ne++;
}
}
printf("%d valor(es) par(es)\n%d valor(es) impar(es)\n%d valor(es) positivo(s)\n%d valor(es) negativo(s)\n",e,o,p,ne);
return 0;
}
Uri 1065 solution in C | Even Between five Numbers
/*Before seeing the code solution make sure that you have tried enough. Don’t copy- paste the whole code. Find out the logic. If you face any trouble, just inform me in comment.*/
#include<stdio.h>
main()
{
int n,c=0,i;
for(i=0;i<5;i++)
{
scanf("%d",&n);
if(n%2==0)
{
c++;
}
}
printf("%d valores pares\n",c);
return 0;
}
//Happy_Coding
#include<stdio.h>
main()
{
int n,c=0,i;
for(i=0;i<5;i++)
{
scanf("%d",&n);
if(n%2==0)
{
c++;
}
}
printf("%d valores pares\n",c);
return 0;
}
Uri 1064 solution in C | Positives and Average
/*Before seeing the code solution make sure that you have tried enough. Don’t copy- paste the whole code. Find out the logic. If you face any trouble, just inform me in comment.*/
#include<stdio.h>
main()
{
int i,c=0;
float s=0,a,n;
for(i=0;i<6;i++)
{
scanf("%f",&n);
if(n>0)
{
s=s+n;
c++;
}
}
a=s/c;
printf("%d valores positivos\n",c);
printf("%.1f\n",a);
return 0;
}
//Happy_Coding
#include<stdio.h>
main()
{
int i,c=0;
float s=0,a,n;
for(i=0;i<6;i++)
{
scanf("%f",&n);
if(n>0)
{
s=s+n;
c++;
}
}
a=s/c;
printf("%d valores positivos\n",c);
printf("%.1f\n",a);
return 0;
}
Uri 1060 solution in C | Positive Numbers
/*Before seeing the code solution make sure that you have tried enough. Don’t copy- paste the whole code. Find out the logic. If you face any trouble, just inform me in comment.*/
#include<stdio.h>
main()
{
double n,i,j=0;
for(i=0;i<6;i++)
{
scanf("%lf",&n);
if(n>0)
{
j++;
}
}
printf("%.0lf valores positivos\n",j);
return 0;
}
//Happy_Coding
#include<stdio.h>
main()
{
double n,i,j=0;
for(i=0;i<6;i++)
{
scanf("%lf",&n);
if(n>0)
{
j++;
}
}
printf("%.0lf valores positivos\n",j);
return 0;
}
Uri 1059 solution in C | Even numbers
/*Before seeing the code solution make sure that you have tried enough. Don’t copy- paste the whole code. Find out the logic. If you face any trouble, just inform me in comment.*/
#include<stdio.h>
main()
{
int i;
for(i=1;i<=100;i++)
{
if(i%2==0)
{
printf("%d\n",i);
}
}
return 0;
}
//Happy_Coding
#include<stdio.h>
main()
{
int i;
for(i=1;i<=100;i++)
{
if(i%2==0)
{
printf("%d\n",i);
}
}
return 0;
}
Uri 1052 solution in C | Month
/*Before seeing the code solution make sure that you have tried enough. Don’t copy- paste the whole code. Find out the logic. If you face any trouble, just inform me in comment.*/
#include<stdio.h>
main()
{
int n;
scanf("%d",&n);
if(n==1)
{
printf("January\n");
}
else if(n==2)
{
printf("February\n");
}
else if(n==3)
{
printf("March\n");
}
else if(n==4)
{
printf("April\n");
}
else if(n==5)
{
printf("May\n");
}
else if(n==6)
{
printf("June\n");
}
else if(n==7)
{
printf("July\n");
}
else if(n==8)
{
printf("August\n");
}
else if(n==9)
{
printf("September\n");
}
else if(n==10)
{
printf("October\n");
}
else if(n==11)
{
printf("November\n");
}
else if(n==12)
{
printf("December\n");
}
return 0;
}
//Happy_Coding
#include<stdio.h>
main()
{
int n;
scanf("%d",&n);
if(n==1)
{
printf("January\n");
}
else if(n==2)
{
printf("February\n");
}
else if(n==3)
{
printf("March\n");
}
else if(n==4)
{
printf("April\n");
}
else if(n==5)
{
printf("May\n");
}
else if(n==6)
{
printf("June\n");
}
else if(n==7)
{
printf("July\n");
}
else if(n==8)
{
printf("August\n");
}
else if(n==9)
{
printf("September\n");
}
else if(n==10)
{
printf("October\n");
}
else if(n==11)
{
printf("November\n");
}
else if(n==12)
{
printf("December\n");
}
return 0;
}
Uri 1051 solution in C | Taxes
/*Before seeing the code solution make sure that you have tried enough. Don’t copy- paste the whole code. Find out the logic. If you face any trouble, just inform me in comment.*/
#include<stdio.h>
main()
{
double n,s,s1;
scanf("%lf",&n);
if(n>0&&n<=2000)
{
printf("Isento\n");
}
else if(n>2000&&n<=3000)
{
s1=n-2000;
s=s1*.08;
printf("R$ %.2lf\n",s);
}
else if(n>3000&&n<=4500)
{
s1=n-3000;
s=80+(s1*.18);
printf("R$ %.2lf\n",s);
}
else if(n>4500)
{
s1=n-4500;
s=350+(s1*.28);
printf("R$ %.2lf\n",s);
}
return 0;
}
//Happy_Coding
#include<stdio.h>
main()
{
double n,s,s1;
scanf("%lf",&n);
if(n>0&&n<=2000)
{
printf("Isento\n");
}
else if(n>2000&&n<=3000)
{
s1=n-2000;
s=s1*.08;
printf("R$ %.2lf\n",s);
}
else if(n>3000&&n<=4500)
{
s1=n-3000;
s=80+(s1*.18);
printf("R$ %.2lf\n",s);
}
else if(n>4500)
{
s1=n-4500;
s=350+(s1*.28);
printf("R$ %.2lf\n",s);
}
return 0;
}
//Happy_Coding
Uri 1050 solution in C | DDD
/*Before seeing the code solution make sure that you have tried enough. Don’t copy- paste the whole code. Find out the logic. If you face any trouble, just inform me in comment.*/
#include <stdio.h>
int main()
{
int N;
scanf("%d",&N);
if(N==61)
printf("Brasilia\n");
else if(N==71)
printf("Salvador\n");
else if(N==11)
printf("Sao Paulo\n");
else if(N==21)
printf("Rio de Janeiro\n");
else if(N==32)
printf("Juiz de Fora\n");
else if(N==19)
printf("Campinas\n");
else if(N==27)
printf("Vitoria\n");
else if(N==31)
printf("Bela Horizonte\n");
else
printf("DDD nao cadastrado\n");
return 0;
}
//Happy_Coding
#include <stdio.h>
int main()
{
int N;
scanf("%d",&N);
if(N==61)
printf("Brasilia\n");
else if(N==71)
printf("Salvador\n");
else if(N==11)
printf("Sao Paulo\n");
else if(N==21)
printf("Rio de Janeiro\n");
else if(N==32)
printf("Juiz de Fora\n");
else if(N==19)
printf("Campinas\n");
else if(N==27)
printf("Vitoria\n");
else if(N==31)
printf("Bela Horizonte\n");
else
printf("DDD nao cadastrado\n");
return 0;
}
//Happy_Coding
Uri 1048 solution in C | Salary Increase
/*Before seeing the code solution make sure that you have tried enough. Don’t copy- paste the whole code. Find out the logic. If you face any trouble, just inform me in comment.*/
#include<stdio.h>
main()
{
float m,s,si;
scanf("%f",&m);
if(m>=0&&m<=400)
{
si=m*.15;
s=m+si;
printf("Novo salario: %.2f\nReajuste ganho: %.2f\nEm percentual: 15 %\n",s,si);
}
else if(m>400&&m<=800)
{
si=m*.12;
s=m+si;
printf("Novo salario: %.2f\nReajuste ganho: %.2f\nEm percentual: 12 %\n",s,si);
}
else if(m>800&&m<=1200)
{
si=m*.10;
s=m+si;
printf("Novo salario: %.2f\nReajuste ganho: %.2f\nEm percentual: 10 %\n",s,si);
}
else if(m>1200&&m<=2000)
{
si=m*.07;
s=m+si;
printf("Novo salario: %.2f\nReajuste ganho: %.2f\nEm percentual: 7 %\n",s,si);
}
else if(m>2000)
{
si=m*.04;
s=m+si;
printf("Novo salario: %.2f\nReajuste ganho: %.2f\nEm percentual: 4 %\n",s,si);
}
}
//Happy_Coding
#include<stdio.h>
main()
{
float m,s,si;
scanf("%f",&m);
if(m>=0&&m<=400)
{
si=m*.15;
s=m+si;
printf("Novo salario: %.2f\nReajuste ganho: %.2f\nEm percentual: 15 %\n",s,si);
}
else if(m>400&&m<=800)
{
si=m*.12;
s=m+si;
printf("Novo salario: %.2f\nReajuste ganho: %.2f\nEm percentual: 12 %\n",s,si);
}
else if(m>800&&m<=1200)
{
si=m*.10;
s=m+si;
printf("Novo salario: %.2f\nReajuste ganho: %.2f\nEm percentual: 10 %\n",s,si);
}
else if(m>1200&&m<=2000)
{
si=m*.07;
s=m+si;
printf("Novo salario: %.2f\nReajuste ganho: %.2f\nEm percentual: 7 %\n",s,si);
}
else if(m>2000)
{
si=m*.04;
s=m+si;
printf("Novo salario: %.2f\nReajuste ganho: %.2f\nEm percentual: 4 %\n",s,si);
}
}
Uri 1047 Solution in C | Game Time with Minutes
/*Before seeing the code solution make sure that you have tried enough. Don’t copy- paste the whole code. Find out the logic. If you face any trouble, just inform me in comment.*/
#include <stdio.h>
int main()
{
int start_h, end_h, start_m, end_m, duration_h, duration_m;
scanf("%d %d %d %d", &start_h, &start_m, &end_h, &end_m);
duration_h = end_h - start_h;
if (duration_h < 0)
{
duration_h = 24 + (end_h - start_h);
}
duration_m = end_m - start_m;
if (duration_m < 0)
{
duration_m = 60 + (end_m - start_m);
duration_h--;
}
if (start_h == end_h && start_m == end_m)
{
printf("O JOGO DUROU 24 HORA(S) E 0 MINUTO(S)\n");
}
else printf("O JOGO DUROU %d HORA(S) E %d MINUTO(S)\n", duration_h, duration_m);
return 0;
}
//Happy_Coding
#include <stdio.h>
int main()
{
int start_h, end_h, start_m, end_m, duration_h, duration_m;
scanf("%d %d %d %d", &start_h, &start_m, &end_h, &end_m);
duration_h = end_h - start_h;
if (duration_h < 0)
{
duration_h = 24 + (end_h - start_h);
}
duration_m = end_m - start_m;
if (duration_m < 0)
{
duration_m = 60 + (end_m - start_m);
duration_h--;
}
if (start_h == end_h && start_m == end_m)
{
printf("O JOGO DUROU 24 HORA(S) E 0 MINUTO(S)\n");
}
else printf("O JOGO DUROU %d HORA(S) E %d MINUTO(S)\n", duration_h, duration_m);
return 0;
}
//Happy_Coding
Uri 1046 Solution in C | Game Time
/*Before seeing the code solution make sure that you have tried enough. Don’t copy- paste the whole code. Find out the logic. If you face any trouble, just inform me in comment.*/
#include <stdio.h>
int main()
{
int st, et, rt;
scanf("%d %d", &st, &et);
rt = et - st;
if (rt < 0)
{
rt = 24 + (et - st);
}
if (st == et)
{
printf("O JOGO DUROU 24 HORA(S)\n");
}
else printf("O JOGO DUROU %d HORA(S)\n", rt);
return 0;
}
//Happy_Coding
#include <stdio.h>
int main()
{
int st, et, rt;
scanf("%d %d", &st, &et);
rt = et - st;
if (rt < 0)
{
rt = 24 + (et - st);
}
if (st == et)
{
printf("O JOGO DUROU 24 HORA(S)\n");
}
else printf("O JOGO DUROU %d HORA(S)\n", rt);
return 0;
}
//Happy_Coding
Uri 1045 solution in C | Triangle Types
/*Before seeing the code solution make sure that you have tried enough. Don’t copy- paste the whole code. Find out the logic. If you face any trouble, just inform me in comment.*/
#include <stdio.h>
int main()
{
double a, b, c, temp;
scanf("%lf %lf %lf", &a, &b, &c);
if (a < b)
{
temp = a;
a = b;
b = temp;
}
if (b < c)
{
temp = b;
b = c;
c = temp;
}
if (a < b)
{
temp = a;
a = b;
b = temp;
}
if (a >= b + c)
{
printf("NAO FORMA TRIANGULO\n");
}
else if (a * a == b * b + c * c)
{
printf("TRIANGULO RETANGULO\n");
}
else if (a * a > b * b + c * c)
{
printf("TRIANGULO OBTUSANGULO\n");
}
else if (a * a < b * b + c * c)
{
printf("TRIANGULO ACUTANGULO\n");
}
if (a == b && b == c)
{
printf("TRIANGULO EQUILATERO\n");
}
else if (a == b || b == c)
{
printf("TRIANGULO ISOSCELES\n");
}
return 0;
}
//Happy_Coding
#include <stdio.h>
int main()
{
double a, b, c, temp;
scanf("%lf %lf %lf", &a, &b, &c);
if (a < b)
{
temp = a;
a = b;
b = temp;
}
if (b < c)
{
temp = b;
b = c;
c = temp;
}
if (a < b)
{
temp = a;
a = b;
b = temp;
}
if (a >= b + c)
{
printf("NAO FORMA TRIANGULO\n");
}
else if (a * a == b * b + c * c)
{
printf("TRIANGULO RETANGULO\n");
}
else if (a * a > b * b + c * c)
{
printf("TRIANGULO OBTUSANGULO\n");
}
else if (a * a < b * b + c * c)
{
printf("TRIANGULO ACUTANGULO\n");
}
if (a == b && b == c)
{
printf("TRIANGULO EQUILATERO\n");
}
else if (a == b || b == c)
{
printf("TRIANGULO ISOSCELES\n");
}
return 0;
}
//Happy_Coding
Uri 1044 Solution in C | Multiples
/*Before seeing the code solution make sure that you have tried enough. Don’t copy- paste the whole code. Find out the logic. If you face any trouble, just inform me in comment.*/
#include<stdio.h>
main()
{
int x,y;
scanf("%d%d",&x,&y);
if(y%x==0||x%y==0)
{
printf("Sao Multiplos\n");
}
else
{
printf("Nao sao Multiplos\n");
}
return 0;
}
//Happy_Coding
#include<stdio.h>
main()
{
int x,y;
scanf("%d%d",&x,&y);
if(y%x==0||x%y==0)
{
printf("Sao Multiplos\n");
}
else
{
printf("Nao sao Multiplos\n");
}
return 0;
}
Uri 1043 Solution in C | Triangle
/*Before seeing the code solution make sure that you have tried enough. Don’t copy- paste the whole code. Find out the logic. If you face any trouble, just inform me in comment.*/
#include<stdio.h>
main()
{
float a,b,c,p,area;
scanf("%f%f%f",&a,&b,&c);
if((a+b)>c&&(b+c)>a&&(c+a)>b)
{
p=a+b+c;
printf("Perimetro = %.1f\n",p);
}
else
{
area=0.5*(a+b)*c;
printf("Area = %.1f\n",area);
}
return 0;
}
//Happy_Coding
#include<stdio.h>
main()
{
float a,b,c,p,area;
scanf("%f%f%f",&a,&b,&c);
if((a+b)>c&&(b+c)>a&&(c+a)>b)
{
p=a+b+c;
printf("Perimetro = %.1f\n",p);
}
else
{
area=0.5*(a+b)*c;
printf("Area = %.1f\n",area);
}
return 0;
}
Uri 1042 solution in C | Simple Sort
/*Before seeing the code solution make sure that you have tried enough. Don’t copy- paste the whole code. Find out the logic. If you face any trouble, just inform me in comment.*/
#include<stdio.h>
main()
{
int a,b,c,min,max,mid;
scanf("%d%d%d",&a,&b,&c);
min=a;
if(b<c&&b<a)
{
min=b;
}
else if(c<a&&c<b)
{
min=c;
}
mid=a;
if(b<a&&b>c||b>a&&b<c)
{
mid=b;
}
else if(c>a&&c<b||c<a&&c>b)
{
mid=c;
}
max=a;
if(b>c&&b>a)
{
max=b;
}
else if(c>a&&c>b)
{
max=c;
}
printf("%d\n%d\n%d\n\n",min,mid,max);
printf("%d\n%d\n%d\n",a,b,c);
return 0;
}
//Happy_Coding
#include<stdio.h>
main()
{
int a,b,c,min,max,mid;
scanf("%d%d%d",&a,&b,&c);
min=a;
if(b<c&&b<a)
{
min=b;
}
else if(c<a&&c<b)
{
min=c;
}
mid=a;
if(b<a&&b>c||b>a&&b<c)
{
mid=b;
}
else if(c>a&&c<b||c<a&&c>b)
{
mid=c;
}
max=a;
if(b>c&&b>a)
{
max=b;
}
else if(c>a&&c>b)
{
max=c;
}
printf("%d\n%d\n%d\n\n",min,mid,max);
printf("%d\n%d\n%d\n",a,b,c);
return 0;
}
Uri 1041 solution in C | Coordinates of a Point
/*Before seeing the code solution make sure that you have tried enough. Don’t copy- paste the whole code. Find out the logic. If you face any trouble, just inform me in comment.*/
#include<stdio.h>
main()
{
float x,y;
scanf("%f%f",&x,&y);
if(x==0&&y==0)
{
printf("Origem\n");
}
else if(x==0&&y!=0)
{
printf("Eixo Y\n");
}
else if(y==0&&x!=0)
{
printf("Eixo X\n");
}
else if(x>0&&y>0)
{
printf("Q1\n");
}
else if(x>0&&y<0)
{
printf("Q4\n");
}
else if(x<0&&y>0)
{
printf("Q2\n");
}
else if(x<0&&y<0)
{
printf("Q3\n");
}
return 0;
}
//Happy_Coding
#include<stdio.h>
main()
{
float x,y;
scanf("%f%f",&x,&y);
if(x==0&&y==0)
{
printf("Origem\n");
}
else if(x==0&&y!=0)
{
printf("Eixo Y\n");
}
else if(y==0&&x!=0)
{
printf("Eixo X\n");
}
else if(x>0&&y>0)
{
printf("Q1\n");
}
else if(x>0&&y<0)
{
printf("Q4\n");
}
else if(x<0&&y>0)
{
printf("Q2\n");
}
else if(x<0&&y<0)
{
printf("Q3\n");
}
return 0;
}
//Happy_Coding
Uri 1040 solution in C | Average 3
/*Before seeing the code solution make sure that you have tried enough. Don’t copy- paste the whole code. Find out the logic. If you face any trouble, just inform me in comment.*/
#include<stdio.h>
main()
{
float n1,n2,n3,n4,m,t;
scanf("%f%f%f%f",&n1,&n2,&n3,&n4);
m=((n1*2)+(n2*3)+(n3*4)+(n4*1))/10;
printf("Media: %.1f\n",m);
if(m>=7)
{
printf("Aluno aprovado.\n");
}
else if(m<5)
{
printf("Aluno reprovado.\n");
}
else if(m>=5&&m<7)
{
printf("Aluno em exame.\n");
float d,r;
scanf("%f",&d);
printf("Nota do exame: %.1f\n",d);
r=(m+d)/2;
if(r>=5)
{
printf("Aluno aprovado.\n");
}
else if(r<5)
{
printf("Aluno reprovado.\n");
}
printf("Media final: %.1f\n",r);
}
return 0;
}
//Happy_Coding
#include<stdio.h>
main()
{
float n1,n2,n3,n4,m,t;
scanf("%f%f%f%f",&n1,&n2,&n3,&n4);
m=((n1*2)+(n2*3)+(n3*4)+(n4*1))/10;
printf("Media: %.1f\n",m);
if(m>=7)
{
printf("Aluno aprovado.\n");
}
else if(m<5)
{
printf("Aluno reprovado.\n");
}
else if(m>=5&&m<7)
{
printf("Aluno em exame.\n");
float d,r;
scanf("%f",&d);
printf("Nota do exame: %.1f\n",d);
r=(m+d)/2;
if(r>=5)
{
printf("Aluno aprovado.\n");
}
else if(r<5)
{
printf("Aluno reprovado.\n");
}
printf("Media final: %.1f\n",r);
}
return 0;
}
Uri 1038 solution in C | Snack
/*Before seeing the code solution make sure that you have tried enough. Don’t copy- paste the whole code. Find out the logic. If you face any trouble, just inform me in comment.*/
#include<stdio.h>
main()
{
int x,y;
float z;
scanf("%d%d",&x,&y);
if(x==1)
{
z=y*4;
}
else if(x==2)
{
z=y*4.5;
}
else if(x==3)
{
z=y*5;
}
else if(x==4)
{
z=y*2;
}
else if(x==5)
{
z=y*1.5;
}
printf("Total: R$ %.2f\n",z);
return 0;
}
//Happy_Coding
#include<stdio.h>
main()
{
int x,y;
float z;
scanf("%d%d",&x,&y);
if(x==1)
{
z=y*4;
}
else if(x==2)
{
z=y*4.5;
}
else if(x==3)
{
z=y*5;
}
else if(x==4)
{
z=y*2;
}
else if(x==5)
{
z=y*1.5;
}
printf("Total: R$ %.2f\n",z);
return 0;
}
//Happy_Coding
Uri 1037 solution in C | Interval
/*Before seeing the code solution make sure that you have tried enough. Don’t copy- paste the whole code. Find out the logic. If you face any trouble, just inform me in comment.*/
#include<stdio.h>
main()
{
float x;
scanf("%f",&x);
if(x<0||x>100)
{
printf("Fora de intervalo\n");
}
else if(x>=0&&x<=25)
{
printf("Intervalo [0,25]\n");
}
else if(x>=25&&x<=50)
{
printf("Intervalo (25,50]\n");
}
else if(x>=50&&x<=75)
{
printf("Intervalo (50,75]\n");
}
else if(x>=75&&x<=100)
{
printf("Intervalo (75,100]\n");
}
else
printf("Fora de intervalo\n");
return 0;
}
//Happy_Coding
#include<stdio.h>
main()
{
float x;
scanf("%f",&x);
if(x<0||x>100)
{
printf("Fora de intervalo\n");
}
else if(x>=0&&x<=25)
{
printf("Intervalo [0,25]\n");
}
else if(x>=25&&x<=50)
{
printf("Intervalo (25,50]\n");
}
else if(x>=50&&x<=75)
{
printf("Intervalo (50,75]\n");
}
else if(x>=75&&x<=100)
{
printf("Intervalo (75,100]\n");
}
else
printf("Fora de intervalo\n");
return 0;
}
//Happy_Coding
Uri 1021 solution in C | Banknotes and Coins
/*Before seeing the code solution make sure that you have tried enough. Don’t copy- paste the whole code. Find out the logic. If you face any trouble, just inform me in comment.*/
#include <stdio.h>
int main() {
int n100, n50, n20, n10, n5, n2;
int m1, m50, m25, m10, m05, m01;
double n;
scanf("%lf", &n);
int notas = n;
int moedas = (n - notas) * 100;
if((moedas * 1000) % 10 == 9){
moedas++;
}
n100 = notas/100;
notas = notas%100;
n50 = notas/50;
notas = notas%50;
n20 = notas/20;
notas = notas%20;
n10 = notas/10;
notas = notas%10;
n5 = notas/5;
notas = notas%5;
n2 = notas/2;
notas = notas%2;
m1 = notas/1;
notas = notas%1;
m50 = moedas/50;
moedas = moedas%50;
m25 = moedas/25;
moedas = moedas%25;
m10 = moedas/10;
moedas = moedas%10;
m05 = moedas/5;
moedas = moedas%5;
m01 = moedas/1;
printf("NOTAS:\n");
printf("%d nota(s) de R$ 100.00\n", n100);
printf("%d nota(s) de R$ 50.00\n", n50);
printf("%d nota(s) de R$ 20.00\n", n20);
printf("%d nota(s) de R$ 10.00\n", n10);
printf("%d nota(s) de R$ 5.00\n", n5);
printf("%d nota(s) de R$ 2.00\n", n2);
printf("MOEDAS:\n");
printf("%d moeda(s) de R$ 1.00\n", m1);
printf("%d moeda(s) de R$ 0.50\n", m50);
printf("%d moeda(s) de R$ 0.25\n", m25);
printf("%d moeda(s) de R$ 0.10\n", m10);
printf("%d moeda(s) de R$ 0.05\n", m05);
printf("%d moeda(s) de R$ 0.01\n", m01);
return 0;
}
//Happy_Coding
#include <stdio.h>
int main() {
int n100, n50, n20, n10, n5, n2;
int m1, m50, m25, m10, m05, m01;
double n;
scanf("%lf", &n);
int notas = n;
int moedas = (n - notas) * 100;
if((moedas * 1000) % 10 == 9){
moedas++;
}
n100 = notas/100;
notas = notas%100;
n50 = notas/50;
notas = notas%50;
n20 = notas/20;
notas = notas%20;
n10 = notas/10;
notas = notas%10;
n5 = notas/5;
notas = notas%5;
n2 = notas/2;
notas = notas%2;
m1 = notas/1;
notas = notas%1;
m50 = moedas/50;
moedas = moedas%50;
m25 = moedas/25;
moedas = moedas%25;
m10 = moedas/10;
moedas = moedas%10;
m05 = moedas/5;
moedas = moedas%5;
m01 = moedas/1;
printf("NOTAS:\n");
printf("%d nota(s) de R$ 100.00\n", n100);
printf("%d nota(s) de R$ 50.00\n", n50);
printf("%d nota(s) de R$ 20.00\n", n20);
printf("%d nota(s) de R$ 10.00\n", n10);
printf("%d nota(s) de R$ 5.00\n", n5);
printf("%d nota(s) de R$ 2.00\n", n2);
printf("MOEDAS:\n");
printf("%d moeda(s) de R$ 1.00\n", m1);
printf("%d moeda(s) de R$ 0.50\n", m50);
printf("%d moeda(s) de R$ 0.25\n", m25);
printf("%d moeda(s) de R$ 0.10\n", m10);
printf("%d moeda(s) de R$ 0.05\n", m05);
printf("%d moeda(s) de R$ 0.01\n", m01);
return 0;
}
//Happy_Coding
Uri 1036 Solution in C | Bhaskara's Formula
/*Before seeing the code solution make sure that you have tried enough. Don’t copy- paste the whole code. Find out the logic. If you face any trouble, just inform me in comment.*/
#include<stdio.h>
main()
{
float a,b,c,x,y;
scanf("%f%f%f",&a,&b,&c);
if(((b*b)-(4*a*c))<0||a==0)
{
printf("Impossivel calcular\n");
}
else
{
x=((-b)+pow(((b*b)-(4*a*c)),0.5))/(2*a);
y=((-b)-pow(((b*b)-(4*a*c)),0.5))/(2*a);
printf("R1 = %.5f\nR2 = %.5f\n",x,y);
}
return 0;
}
//Happy_Coding
#include<stdio.h>
main()
{
float a,b,c,x,y;
scanf("%f%f%f",&a,&b,&c);
if(((b*b)-(4*a*c))<0||a==0)
{
printf("Impossivel calcular\n");
}
else
{
x=((-b)+pow(((b*b)-(4*a*c)),0.5))/(2*a);
y=((-b)-pow(((b*b)-(4*a*c)),0.5))/(2*a);
printf("R1 = %.5f\nR2 = %.5f\n",x,y);
}
return 0;
}
Uri 1035 solution in C | Selection Test 1
/*Before seeing the code solution make sure that you have tried enough. Don’t copy- paste the whole code. Find out the logic. If you face any trouble, just inform me in comment.*/
#include<stdio.h>
main()
{
int a,b,c,d;
scanf("%d%d%d%d",&a,&b,&c,&d);
if(b>c&&d>a&&(c+d)>(a+b)&&(c&&d)>=0&&a%2==0)
{
printf("Valores aceitos\n");
}
else
printf("Valores nao aceitos\n");
return 0;
}
//Happy_Coding
#include<stdio.h>
main()
{
int a,b,c,d;
scanf("%d%d%d%d",&a,&b,&c,&d);
if(b>c&&d>a&&(c+d)>(a+b)&&(c&&d)>=0&&a%2==0)
{
printf("Valores aceitos\n");
}
else
printf("Valores nao aceitos\n");
return 0;
}
//Happy_Coding
Uri 1020 solution in C | Age in Days
/*Before seeing the code solution make sure that you have tried enough. Don’t copy- paste the whole code. Find out the logic. If you face any trouble, just inform me in comment.*/
#include<stdio.h>
main()
{
int n,y,m,d,n1,n2;
scanf("%d",&n);
y=n/365;
n1=n%365;
m=n1/30;
n2=n1%30;
d=n2;
printf("%d ano(s)\n%d mes(es)\n%d dia(s)\n",y,m,d);
return 0;
}
//Happy_Coding
#include<stdio.h>
main()
{
int n,y,m,d,n1,n2;
scanf("%d",&n);
y=n/365;
n1=n%365;
m=n1/30;
n2=n1%30;
d=n2;
printf("%d ano(s)\n%d mes(es)\n%d dia(s)\n",y,m,d);
return 0;
}
Uri 1018 Solution in C | Banknotes
/*Before seeing the code solution make sure that you have tried enough. Don’t copy- paste the whole code. Find out the logic. If you face any trouble, just inform me in comment.*/
#include <stdio.h>
int main()
{
int n;
scanf("%d", &n);
printf("%d\n", n);
printf("%d nota(s) de R$ 100,00\n", n/100);
n %= 100;
printf("%d nota(s) de R$ 50,00\n", n/50);
n %= 50;
printf("%d nota(s) de R$ 20,00\n", n/20);
n %= 20;
printf("%d nota(s) de R$ 10,00\n", n/10);
n %= 10;
printf("%d nota(s) de R$ 5,00\n", n/5);
n %= 5;
printf("%d nota(s) de R$ 2,00\n", n/2);
n %= 2;
printf("%d nota(s) de R$ 1,00\n", n);
return 0;
}
//Happy_Coding
#include <stdio.h>
int main()
{
int n;
scanf("%d", &n);
printf("%d\n", n);
printf("%d nota(s) de R$ 100,00\n", n/100);
n %= 100;
printf("%d nota(s) de R$ 50,00\n", n/50);
n %= 50;
printf("%d nota(s) de R$ 20,00\n", n/20);
n %= 20;
printf("%d nota(s) de R$ 10,00\n", n/10);
n %= 10;
printf("%d nota(s) de R$ 5,00\n", n/5);
n %= 5;
printf("%d nota(s) de R$ 2,00\n", n/2);
n %= 2;
printf("%d nota(s) de R$ 1,00\n", n);
return 0;
}
//Happy_Coding
Uri 1019 solution in C | Time Conversion
/*Before seeing the code solution make sure that you have tried enough. Don’t copy- paste the whole code. Find out the logic. If you face any trouble, just inform me in comment.*/
#include<stdio.h>
main()
{
int n,h,m,s,n1,n2;
scanf("%d",&n);
h=n/3600;
n1=n%3600;
m=n1/60;
n2=n1%60;
s=n2;
printf("%d:%d:%d\n",h,m,s);
return 0;
}
//Happy_Coding
#include<stdio.h>
main()
{
int n,h,m,s,n1,n2;
scanf("%d",&n);
h=n/3600;
n1=n%3600;
m=n1/60;
n2=n1%60;
s=n2;
printf("%d:%d:%d\n",h,m,s);
return 0;
}
Uri 1017 Solution in C | Fuel Spent
/*Before seeing the code solution make sure that you have tried enough. Don’t copy- paste the whole code. Find out the logic. If you face any trouble, just inform me in comment.*/
#include<stdio.h>
main()
{
int a,b;
float c;
scanf("%d%d",&a,&b);
c=(a*b)/12.0;
printf("%.3f\n",c);
return 0;
}
//Happy_Coding
#include<stdio.h>
main()
{
int a,b;
float c;
scanf("%d%d",&a,&b);
c=(a*b)/12.0;
printf("%.3f\n",c);
return 0;
}
Uri 1016 solution in C | Distance
/*Before seeing the code solution make sure that you have tried enough. Don’t copy- paste the whole code. Find out the logic. If you face any trouble, just inform me in comment.*/
#include<stdio.h>
main()
{
int a;
scanf("%d",&a);
printf("%d minutos\n",a*2);
return 0;
}
//Happy_Coding
#include<stdio.h>
main()
{
int a;
scanf("%d",&a);
printf("%d minutos\n",a*2);
return 0;
}
Uri 1015 solution in C | Distance Between Two Points
/*Before seeing the code solution make sure that you have tried enough. Don’t copy- paste the whole code. Find out the logic. If you face any trouble, just inform me in comment.*/
#include<stdio.h>
#include<math.h>
main()
{
double x1,y1,x2,y2,d;
scanf("%lf%lf%lf%lf",&x1,&y1,&x2,&y2);
d=sqrt(((y2-y1)*(y2-y1))+((x2-x1)*(x2-x1)));
printf("%.4lf\n",d);
return 0;
}
//Happy_Coding
#include<stdio.h>
#include<math.h>
main()
{
double x1,y1,x2,y2,d;
scanf("%lf%lf%lf%lf",&x1,&y1,&x2,&y2);
d=sqrt(((y2-y1)*(y2-y1))+((x2-x1)*(x2-x1)));
printf("%.4lf\n",d);
return 0;
}
Uri 1014 solution in C | Consumption
/*Before seeing the code solution make sure that you have tried enough. Don’t copy- paste the whole code. Find out the logic. If you face any trouble, just inform me in comment.*/
#include<stdio.h>
main()
{
int x;
float y,t;
scanf("%d%f",&x,&y);
t=x/y;
printf("%.3f km/l\n",t);
return 0;
}
//Happy_Coding
#include<stdio.h>
main()
{
int x;
float y,t;
scanf("%d%f",&x,&y);
t=x/y;
printf("%.3f km/l\n",t);
return 0;
}
//Happy_Coding
Uri 1013 solution in C | The Greatest
/*Before seeing the code solution make sure that you have tried enough. Don’t copy- paste the whole code. Find out the logic. If you face any trouble, just inform me in comment.*/
#include<stdio.h>
main()
{
int a,b,c,MAIRORAB,mairor;
scanf("%d%d%d",&a,&b,&c);
MAIRORAB=((a+b)+abs(a-b))/2;
mairor=((MAIRORAB+c)+abs(MAIRORAB-c))/2;
printf("%d eh o maior\n",mairor);
return 0;
}
#include<stdio.h>
main()
{
int a,b,c,MAIRORAB,mairor;
scanf("%d%d%d",&a,&b,&c);
MAIRORAB=((a+b)+abs(a-b))/2;
mairor=((MAIRORAB+c)+abs(MAIRORAB-c))/2;
printf("%d eh o maior\n",mairor);
return 0;
}
//Happy_Coding
Uri 1012 solution | Area
/*Before seeing the code solution make sure that you have tried enough. Don’t copy- paste the whole code. Find out the logic. If you face any trouble, just inform me in comment.*/
#include<stdio.h>
main()
{
double a,b,c,x,y,z,r,s,pi=3.14159;
scanf("%lf%lf%lf",&a,&b,&c);
x=0.5*a*c;
y=pi*c*c;
z=0.5*(a+b)*c;
r=b*b;
s=a*b;
printf("TRIANGULO: %.3f\nCIRCULO: %.3f\nTRAPEZIO: %.3f\nQUADRADO: %.3f\nRETANGULO: %.3f\n",x,y,z,r,s);
return 0;
}
#include<stdio.h>
main()
{
double a,b,c,x,y,z,r,s,pi=3.14159;
scanf("%lf%lf%lf",&a,&b,&c);
x=0.5*a*c;
y=pi*c*c;
z=0.5*(a+b)*c;
r=b*b;
s=a*b;
printf("TRIANGULO: %.3f\nCIRCULO: %.3f\nTRAPEZIO: %.3f\nQUADRADO: %.3f\nRETANGULO: %.3f\n",x,y,z,r,s);
return 0;
}
//Happy_Coding
Uri 1011 solution | Sphere
/*Before seeing the code solution make sure that you have tried enough. Don’t copy- paste the whole code. Find out the logic. If you face any trouble, just inform me in comment.*/
#include<stdio.h>
main()
{
double r,v,pi=3.14159;
scanf("%lf",&r);
v=((4.0/3.0)*(pi)*(r*r*r));
printf("VOLUME = %.3lf\n",v);
return 0;
}
#include<stdio.h>
main()
{
double r,v,pi=3.14159;
scanf("%lf",&r);
v=((4.0/3.0)*(pi)*(r*r*r));
printf("VOLUME = %.3lf\n",v);
return 0;
}
//Happy_coding
Uri 1010 solution in C | Simple Calculate
/*Before seeing the code solution make sure that you have tried enough. Don’t copy- paste the whole code. Find out the logic. If you face any trouble, just inform me in comment.*/
#include<stdio.h>
main()
{
int c1,c2,a1,a2;
float p1,p2,total;
scanf("%d%d%f\n%d%d%f",&c1,&a1,&p1,&c2,&a2,&p2);
//scanf("%f%f%f",&c1,&a2,&p2);
total=(a1*p1)+(a2*p2);
printf("VALOR A PAGAR: R$ %.2f\n",total);
return 0;
}
#include<stdio.h>
main()
{
int c1,c2,a1,a2;
float p1,p2,total;
scanf("%d%d%f\n%d%d%f",&c1,&a1,&p1,&c2,&a2,&p2);
//scanf("%f%f%f",&c1,&a2,&p2);
total=(a1*p1)+(a2*p2);
printf("VALOR A PAGAR: R$ %.2f\n",total);
return 0;
}
//Happy_coding
Uri 1009 solution | salary with bonus
/*Before seeing the code solution make sure that you have tried enough. Don’t copy- paste the whole code. Find out the logic. If you face any trouble, just inform me in comment.*/
#include<stdio.h>
main()
{
char name;
double sal,b,ts;
scanf("%s%lf%lf",&name,&sal,&b);
ts=sal+(b*.15);
printf("TOTAL = R$ %.2lf\n",ts);
return 0;
}
#include<stdio.h>
main()
{
char name;
double sal,b,ts;
scanf("%s%lf%lf",&name,&sal,&b);
ts=sal+(b*.15);
printf("TOTAL = R$ %.2lf\n",ts);
return 0;
}
//Happy_coding
Uri 1008 Solution in C | Salary
/*Before seeing the code solution make sure that you have tried enough. Don’t copy- paste the whole code. Find out the logic. If you face any trouble, just inform me in comment.*/
#include<stdio.h>
main()
{
int n,wh;
float s,t;
scanf("%d%d%f",&n,&wh,&s);
t=wh*s;
printf("NUMBER = %d\nSALARY = U$ %.2f\n",n,t);
return 0;
}
//Happy_coding
#include<stdio.h>
main()
{
int n,wh;
float s,t;
scanf("%d%d%f",&n,&wh,&s);
t=wh*s;
printf("NUMBER = %d\nSALARY = U$ %.2f\n",n,t);
return 0;
}
//Happy_coding
Uri 1007 Solution in C | Difference
/*Before seeing the code solution make sure that you have tried enough. Don’t copy- paste the whole code. Find out the logic. If you face any trouble, just inform me in comment.*/
#include<stdio.h>
main()
{
int A,B,C,D,DIFERENCA;
scanf("%d %d %d %d",&A, &B, &C, &D);
DIFERENCA=(A * B - C * D);
printf("DIFERENCA = %d\n",DIFERENCA);
return 0;
}
//Happy_coding
#include<stdio.h>
main()
{
int A,B,C,D,DIFERENCA;
scanf("%d %d %d %d",&A, &B, &C, &D);
DIFERENCA=(A * B - C * D);
printf("DIFERENCA = %d\n",DIFERENCA);
return 0;
}
//Happy_coding
Thursday, October 25, 2018
URI 1006 Solution in C | Average 2
//URI Online Judge 1006 Solution in C | Average 2
#include<stdio.h>
int main(){
float A,B,C,med;
scanf("%f %f %f",&A,&B,&C);
med=((A*2)+(B*3)+(C*5))/(2+3+5);
printf("MEDIA = %.1f\n",med);
return 0;
}
//Happy_coding
#include<stdio.h>
int main(){
float A,B,C,med;
scanf("%f %f %f",&A,&B,&C);
med=((A*2)+(B*3)+(C*5))/(2+3+5);
printf("MEDIA = %.1f\n",med);
return 0;
}
//Happy_coding
URI 1005 Solution in C | Average 1
//URI Online Judge 1005 Solution in C | Average 1
#include<stdio.h>
int main(){
float A,B,med;
scanf("%f %f",&A,&B);
med=((A*3.5)+(B*7.5))/(3.5+7.5);
printf("MEDIA = %.5f\n",med);
return 0;
}
//Happy_coding
#include<stdio.h>
int main(){
float A,B,med;
scanf("%f %f",&A,&B);
med=((A*3.5)+(B*7.5))/(3.5+7.5);
printf("MEDIA = %.5f\n",med);
return 0;
}
//Happy_coding
URI 1004 Solution in C | Simple Product
//URI Online Judge 1004 Solution in C | Simple Product
#include<stdio.h>
main()
{
int A,B,PROD;
scanf("%d%d",&A,&B);
PROD=A*B;
printf("PROD = %d\n",PROD);
return 0;
}
//Happy_coding
URI 1003 Solution in C | Simple Sum
//URI Online Judge | 1003 Solution in C | Simple Sum
#include<stdio.h>
main()
{
int A,B,SOMA;
scanf("%d%d",&A,&B);
SOMA=A+B;
printf("SOMA = %d\n",SOMA);
return 0;
}
#include<stdio.h>
main()
{
int A,B,SOMA;
scanf("%d%d",&A,&B);
SOMA=A+B;
printf("SOMA = %d\n",SOMA);
return 0;
}
//Happy_Coding
URI 1002 Solution in C | Area of a Circle
//1002 - Area of a Circle
#include<stdio.h>
main()
{
double PI=3.14159,R,A;
scanf("%lf",&R);
A=PI*(R*R);
printf("A=%.4lf\n",A);
return 0;
}
//Happy_coding
#include<stdio.h>
main()
{
double PI=3.14159,R,A;
scanf("%lf",&R);
A=PI*(R*R);
printf("A=%.4lf\n",A);
return 0;
}
//Happy_coding
URI 1001 Solution in C | Extremely Basic
//URI Online Judge | 1001
//Happy_coding
#include<stdio.h>
main()
{
int A,B,X;
scanf("%d%d",&A,&B);
X=A+B;
printf("X = %d\n",X);
return 0;
}
//Happy_coding
#include<stdio.h>
main()
{
int A,B,X;
scanf("%d%d",&A,&B);
X=A+B;
printf("X = %d\n",X);
return 0;
}
Subscribe to:
Posts (Atom)