Beecrowd Problem 1101-1120 Solve by C
Beecrowd Problem 1101
#include <stdio.h> int main(){ int n; int x, y, aux; int soma; while(1){ scanf("%d%d",&x,&y); if(x <= 0) break; if(y <= 0) break; if(x > y){ aux = x; x = y; y = aux; } soma = 0; for(int i = x; i <= y; i++){ printf("%d ",i); soma += i; } printf("Sum=%d\n",soma); } return 0; }
Beecrowd Problem 1102
Beecrowd Problem 1103
Beecrowd Problem 1104
Beecrowd Problem 1105
Beecrowd Problem 1106
Beecrowd Problem 1107
Beecrowd Problem 1108
Beecrowd Problem 1109
Beecrowd Problem 1110
Beecrowd Problem 1111
Beecrowd Problem 1112
Beecrowd Problem 1113
#include<stdio.h> int main() { int x,y; while(1) { scanf("%d %d",&x,&y); if(x==y) break; else { if(x<y) { printf("Crescente\n"); } else { printf("Decrescente\n"); } } } return 0; }
Beecrowd Problem 1114
#include<stdio.h> int main() { int n; while(1) { scanf("%d",&n); if(n==2002) { printf("Acesso Permitido\n"); break; } else { printf("Senha Invalida\n"); } } return 0; }
Beecrowd Problem 1115
#include<stdio.h> int main() { int i,j; for(i=1,j=60;i<15,j>=0;i+=3,j-=5){ printf("I=%d J=%d\n",i,j); } }
Beecrowd Problem 1116
#include <stdio.h>
int main()
{
int n, i;
float x, y;
scanf(“%d”, &n);
for(i = 0; i < n; ++i)
{
scanf(“%f %f”, &x, &y);
if(y == 0)
{
printf(“divisao impossivel\n”);
}
else
{
printf(“%.1f\n”, (x/y) );
}
}
return 0;
}
Beecrowd Problem 1117
#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; }
Beecrowd Problem 1118
#include<stdio.h> int main() { float n,s,p,k; s = p = k = 0; while(1) { scanf("%f",&n); if(n < 0.0 || n > 10.0) printf("nota invalida\n"); else { s += n; p++; if(p==2) { s/=2; printf("media = %.2lf\n",s); printf("novo calculo (1-sim 2-nao)\n"); while(1) { scanf("%f",&n); if((int)n==1) { s = p = 0; k=1; break; } else if((int)n==2) return 0; else printf("novo calculo (1-sim 2-nao)\n"); } } } } return 0; }
Beecrowd Problem 1119
#include<stdio.h> int main(){ int n; int x, y, aux; int soma; scanf("%d",&n); while(1){ if(n == 0) break; scanf("%d%d",&x,&y); if(x > y){ aux = x; x = y; y = aux; } soma = 0; for(int i = x+1; i < y; i++){ if(i%2 != 0) soma += i; } printf("%d\n",soma); n--; } return 0; }
Beecrowd Problem 1120
Leave a Reply