diff --git a/1000.c b/1000.c new file mode 100644 index 0000000..ae87f86 --- /dev/null +++ b/1000.c @@ -0,0 +1,8 @@ +#include + +int main() { + + printf("Hello World!\n"); + + return 0; +} diff --git a/1001.c b/1001.c new file mode 100644 index 0000000..9771185 --- /dev/null +++ b/1001.c @@ -0,0 +1,14 @@ +#include + +int main() { + + int A, B, X; + + scanf("%i %i", &A, &B); + + X = A + B; + + printf("X = %i\n", X); + + return 0; +} diff --git a/1002.c b/1002.c new file mode 100644 index 0000000..015380d --- /dev/null +++ b/1002.c @@ -0,0 +1,14 @@ +#include + +int main() { + + double raio, area, pi = 3.14159; + + scanf("%lf", &raio); + + area= pi * raio * raio; + + printf("A=%.4lf\n", area); + + return 0; +} diff --git a/1003.c b/1003.c new file mode 100644 index 0000000..838e8fc --- /dev/null +++ b/1003.c @@ -0,0 +1,17 @@ +#include + +int main() { + + int A, B, SOMA; + + scanf("%i", &A); + scanf("%i", &B); + + SOMA = A + B; + + printf("SOMA = %i\n", SOMA); + + return 0; +} + + diff --git a/1004.c b/1004.c new file mode 100644 index 0000000..ac4490a --- /dev/null +++ b/1004.c @@ -0,0 +1,13 @@ +#include + +int main() { + + int A, B, PROD; + + scanf("%i %i", &A, &B); + + PROD = A*B; + + printf("PROD = %i\n", PROD); + return 0; +} diff --git a/1005.c b/1005.c new file mode 100644 index 0000000..6113119 --- /dev/null +++ b/1005.c @@ -0,0 +1,14 @@ +#include + +int main() { + + double A, B, media; + + scanf("%lf %lf", &A, &B); + + media= (A*3.5 + B*7.5)/11; + + printf("MEDIA = %.5lf\n", media); + + return 0; +} diff --git a/1006.c b/1006.c new file mode 100644 index 0000000..d42b1e9 --- /dev/null +++ b/1006.c @@ -0,0 +1,14 @@ +#include + +int main() { + + double A, B, C, media; + + scanf("%lf %lf %lf", &A, &B, &C); + + media= (A*2 + B*3 + C*5)/10; + + printf("MEDIA = %.1lf\n", media); + + return 0; +} diff --git a/1007.c b/1007.c new file mode 100644 index 0000000..3bebd77 --- /dev/null +++ b/1007.c @@ -0,0 +1,14 @@ +#include + +int main() { + + int A, B, C, D, DIFERENCA; + + scanf("%i %i %i %i", &A, &B, &C, &D); + + DIFERENCA = (A*B - C*D); + + printf("DIFERENCA = %i\n", DIFERENCA); + + return 0; +} diff --git a/1008.c b/1008.c new file mode 100644 index 0000000..fe30cbe --- /dev/null +++ b/1008.c @@ -0,0 +1,16 @@ +#include + +int main() { + + int funcionario, horas; + float salario, valor; + + scanf("%i %i %f", &funcionario, &horas, &valor); + + salario= horas * valor; + + printf("NUMBER = %i\n", funcionario); + printf("SALARY = U$ %.2f\n", salario); + +return 0; +} diff --git a/1009.c b/1009.c new file mode 100644 index 0000000..c730506 --- /dev/null +++ b/1009.c @@ -0,0 +1,16 @@ +#include + +int main() { + + char nome[50]; + double salario, vendas, total; + + scanf("%s", &nome); + scanf("%lf %lf", &salario, &vendas); + + total= 0.15*vendas + salario; + + printf("TOTAL = R$ %.2lf\n", total); + + return 0; +} diff --git a/1010.c b/1010.c new file mode 100644 index 0000000..9177fb6 --- /dev/null +++ b/1010.c @@ -0,0 +1,14 @@ +#include + +int main() { + + int c1, n1, c2, n2; + float v1, v2, total; + + scanf("%i %i %f", &c1, &n1, &v1); + scanf("%i %i %f", &c2, &n2, &v2); + + total = n1*v1 + n2*v2; + + printf("VALOR A PAGAR: R$ %.2f\n", total); +} diff --git a/1011.c b/1011.c new file mode 100644 index 0000000..56465c3 --- /dev/null +++ b/1011.c @@ -0,0 +1,13 @@ +#include + +int main() { + + double r, V; + + scanf("%lf", &r); + + V= (4/3.0) * 3.14159 * r * r * r; + + printf("VOLUME = %.3lf\n", V); + return 0; +} diff --git a/1012.c b/1012.c new file mode 100644 index 0000000..deb9941 --- /dev/null +++ b/1012.c @@ -0,0 +1,23 @@ +#include + +int main(){ + float A, B, C; + float Ac, Ar, At, Aq, Atri; + + scanf("%f %f %f", &A, &B, &C); + + Atri= (A*C)/2; + + Ac= C * C * 3.14159; + + At= ((A+B)*C)/2; + + Aq= B*B; + + Ar= A*B; + + printf("TRIANGULO: %.3f\nCIRCULO: %.3f\nTRAPEZIO: %.3f\nQUADRADO: %.3f\nRETANGULO: %.3f\n", Atri, Ac, At, Aq, Ar); + +return 0; + +} diff --git a/1013.c b/1013.c new file mode 100644 index 0000000..a18e1a4 --- /dev/null +++ b/1013.c @@ -0,0 +1,19 @@ +#include +#include + +int main() +{ + int a, b, c, maior; + + scanf("%i %i %i", &a, &b, &c); + + maior= (a+b+abs(a-b))/2; + + if(c>maior){ + printf("%i eh o maior\n", c); + } + else{ + printf("%i eh o maior\n", maior); + } + return 0; +} diff --git a/1014.c b/1014.c new file mode 100644 index 0000000..6488092 --- /dev/null +++ b/1014.c @@ -0,0 +1,15 @@ +#include + +int main() { + + int X; + float Y, total; + + scanf("%i %f", &X, &Y); + + total= X/Y; + + printf("%.3f km/l\n", total); + + return 0; +} diff --git a/1015.c b/1015.c new file mode 100644 index 0000000..915855a --- /dev/null +++ b/1015.c @@ -0,0 +1,17 @@ +#include +#include + +int main() { + + float x1, y1, x2, y2, distancia; + + scanf("%f %f", &x1, &y1); + scanf("%f %f", &x2, &y2); + + distancia= sqrt(pow(x2-x1,2)+pow(y2-y1,2)); + + + printf("%.4f\n", distancia); + + return 0; +} diff --git a/1016.c b/1016.c new file mode 100644 index 0000000..4811fec --- /dev/null +++ b/1016.c @@ -0,0 +1,14 @@ +#include + +int main() { + + int distancia, conta; + + scanf("%i", &distancia); + + conta= 2*distancia; + + printf("%i minutos\n", conta); + + return 0; +} diff --git a/1017.c b/1017.c new file mode 100644 index 0000000..ac21249 --- /dev/null +++ b/1017.c @@ -0,0 +1,17 @@ +#include + +int main() { + + int horas, VM; + float distancia, litros; + + scanf("%i %i", &horas, &VM); + + distancia= horas*VM; + + litros= distancia/12; + + printf("%.3f\n", litros); + +return 0; +} diff --git a/1018.c b/1018.c new file mode 100644 index 0000000..785ed92 --- /dev/null +++ b/1018.c @@ -0,0 +1,27 @@ +#include + +int main() +{ + int N; + + scanf("%i", &N); + + printf("%i\n", N); + + printf("%i nota(s) de R$ 100,00\n", N/100); + N= N%100; + printf("%i nota(s) de R$ 50,00\n", N/50); + N= N%50; + printf("%i nota(s) de R$ 20,00\n", N/20); + N= N%20; + printf("%i nota(s) de R$ 10,00\n", N/10); + N= N%10; + printf("%i nota(s) de R$ 5,00\n", N/5); + N= N%5; + printf("%i nota(s) de R$ 2,00\n", N/2); + N= N%2; + printf("%i nota(s) de R$ 1,00\n", N); + + + return 0; +} diff --git a/1019.c b/1019.c new file mode 100644 index 0000000..514a4e8 --- /dev/null +++ b/1019.c @@ -0,0 +1,18 @@ +#include + +int main() { + + int N, horas, minutos, segundos; + + scanf("%i", &N); + + minutos= N/60; + segundos= N%60; + horas= minutos/60; + minutos= minutos%60; + + printf("%i:%i:%i\n", horas, minutos, segundos); + + return 0; +} + diff --git a/1020.c b/1020.c new file mode 100644 index 0000000..060078f --- /dev/null +++ b/1020.c @@ -0,0 +1,16 @@ +#include + +int main() { + + int idade, anos, meses, dias; + + scanf("%i", &idade); + + anos= idade/365; + meses= (idade%365)/30; + dias= (idade%365)%30; + + printf("%i ano(s)\n%i mes(es)\n%i dia(s)\n", anos, meses, dias); + + return 0; +} diff --git a/1021V1.c b/1021V1.c new file mode 100644 index 0000000..d427290 --- /dev/null +++ b/1021V1.c @@ -0,0 +1,42 @@ +#include + +int main() +{ + double flot; + int N, centavos; + + scanf("%lf", &flot); + + N= flot; + centavos= flot*100 - N*100; + + printf("NOTAS:\n"); + printf("%i nota(s) de R$ 100.00\n", N/100); + N= N%100; + printf("%i nota(s) de R$ 50.00\n", N/50); + N= N%50; + printf("%i nota(s) de R$ 20.00\n", N/20); + N= N%20; + printf("%i nota(s) de R$ 10.00\n", N/10); + N= N%10; + printf("%i nota(s) de R$ 5.00\n", N/5); + N= N%5; + printf("%i nota(s) de R$ 2.00\n", N/2); + + N= N%2; + printf("MOEDAS:\n"); + printf("%i moeda(s) de R$ 1.00\n", N); + + printf("%i moeda(s) de R$ 0.50\n", centavos/50); + centavos= centavos%50; + printf("%i moeda(s) de R$ 0.25\n", centavos/25); + centavos= centavos%25; + printf("%i moeda(s) de R$ 0.10\n", centavos/10); + centavos= centavos%10; + printf("%i moeda(s) de R$ 0.05\n", centavos/5); + centavos= centavos%5; + printf("%i moeda(s) de R$ 0.01\n", centavos); + + + return 0; +} diff --git a/1021V2.c b/1021V2.c new file mode 100644 index 0000000..9eb76d3 --- /dev/null +++ b/1021V2.c @@ -0,0 +1,43 @@ +#include + +int main() +{ + double flot; + int N; + + scanf("%lf", &flot); + + N= flot*100; + + + printf("NOTAS:\n"); + printf("%i nota(s) de R$ 100.00\n", N/10000); + N= N%10000; + printf("%i nota(s) de R$ 50.00\n", N/5000); + N= N%5000; + printf("%i nota(s) de R$ 20.00\n", N/2000); + N= N%2000; + printf("%i nota(s) de R$ 10.00\n", N/1000); + N= N%1000; + printf("%i nota(s) de R$ 5.00\n", N/500); + N= N%500; + printf("%i nota(s) de R$ 2.00\n", N/200); + N= N%200; + + + printf("MOEDAS:\n"); + printf("%i moeda(s) de R$ 1.00\n", N/100); + N= N%100; + printf("%i moeda(s) de R$ 0.50\n", N/50); + N= N%50; + printf("%i moeda(s) de R$ 0.25\n", N/25); + N= N%25; + printf("%i moeda(s) de R$ 0.10\n", N/10); + N= N%10; + printf("%i moeda(s) de R$ 0.05\n", N/5); + N= N%5; + printf("%i moeda(s) de R$ 0.01\n", N); + + + return 0; +} diff --git a/1022.c b/1022.c new file mode 100644 index 0000000..11be2a9 --- /dev/null +++ b/1022.c @@ -0,0 +1,91 @@ +#include + +int main() +{ + int N1, N2, N3, N4, N, denominador, numerador, denominadorMenor, numeradorMenor; + char string[1000], operador; + + scanf("%i", &N); + + getchar(); + + while(N > 0){ + + fgets(string, 1000, stdin); + + sscanf(string, "%i / %i %c %i / %i", &N1, &N2, &operador, &N3, &N4); + + if(operador == '*'){ + numerador = N1 * N3; + denominador = N2 * N4; + + denominadorMenor = denominador; + numeradorMenor = numerador; + + for(int i = 2; i < 99; i++){ + if(denominadorMenor % i == 0 && numeradorMenor % i == 0){ + denominadorMenor /= i; + numeradorMenor /= i; + i = 1; + } + } + printf("%i/%i = %i/%i\n", numerador, denominador, numeradorMenor, denominadorMenor); + } + + else if(operador == '/'){ + denominador = N2 * N3; + numerador = N1 * N4; + + denominadorMenor = denominador; + numeradorMenor = numerador; + + for(int i = 2; i < 99; i++){ + if(denominadorMenor % i == 0 && numeradorMenor % i == 0){ + denominadorMenor /= i; + numeradorMenor /= i; + i = 1; + } + } + + printf("%i/%i = %i/%i\n", numerador, denominador, numeradorMenor, denominadorMenor); + } + + else if(operador == '+'){ + denominador = N2 * N4; + numerador = (N1 * N4 + N2 * N3); + + denominadorMenor = denominador; + numeradorMenor = numerador; + for(int i = 2; i < 99; i++){ + if(denominadorMenor % i == 0 && numeradorMenor % i == 0){ + denominadorMenor /= i; + numeradorMenor /= i; + i = 1; + } + } + + printf("%i/%i = %i/%i\n", numerador, denominador, numeradorMenor, denominadorMenor); + } + + else{ + denominador = N2 * N4; + numerador = (N1 * N4 - N2 * N3); + + denominadorMenor = denominador; + numeradorMenor = numerador; + for(int i = 2; i < 99; i++){ + if(denominadorMenor % i == 0 && numeradorMenor % i == 0){ + denominadorMenor /= i; + numeradorMenor /= i; + i = 1; + } + } + + printf("%i/%i = %i/%i\n", numerador, denominador, numeradorMenor, denominadorMenor); + } + + N--; + } + + return 0; +} diff --git a/1024.c b/1024.c new file mode 100644 index 0000000..83174dc --- /dev/null +++ b/1024.c @@ -0,0 +1,46 @@ +#include +#include +#include + +int main() { + + int N, inicioMetade; + char string[1001]; + + scanf("%i", &N); + getchar(); + + while(N > 0){ + + fgets(string, 1001, stdin); + + int i = 0, j = strlen(string) - 1; + char aux; + + for(i = 0; i < strlen(string) - 1; i++){ //passo 1 + if(isalpha(string[i])) + string[i] += 3; + } + + for(i = 0, j = strlen(string) - 2; i < j; i++, j--){ //passo 2 + aux = string[i]; + string[i] = string[j]; + string[j] = aux; + } + + if(strlen(string) % 2 == 0) + inicioMetade = strlen(string)/2 - 1; + else + inicioMetade = strlen(string)/2; + + for(i = inicioMetade; i <= strlen(string) - 2; i++){ //passo 3 + string[i] --; + } + + fputs(string, stdout); + + N--; + } + + return 0; +} diff --git a/1028.c b/1028.c new file mode 100644 index 0000000..137b1af --- /dev/null +++ b/1028.c @@ -0,0 +1,35 @@ +#include +#include + +int main() { + + int n, f1, f2, f1n, f2n, max; + + scanf("%i", &n); + + while(n>0){ + + scanf("%i %i", &f1, &f2); + + if(f1>=f2){ + while(f1!=f2){ + f1n= f1; + f1= f2; + f2= abs(f1n-f1); + } + printf("%i\n", f2); + } + + else if(f2>=f1){ + while(f2!=f1){ + f2n= f2; + f2= f1; + f1= abs(f2n-f2); + } + printf("%i\n", f1); + } + n--; + } + + return 0; +} diff --git a/1029.c b/1029.c new file mode 100644 index 0000000..9b389a6 --- /dev/null +++ b/1029.c @@ -0,0 +1,37 @@ +#include + +int fibonacci(int n, int *calls); + +int main() { + int n, T; + + scanf("%i", &T); + + while(T > 0){ + int calls = 0; + + scanf("%i", &n); + + printf("fib(%i) = %i calls = %i\n", n, calls - 1, fibonacci(n , &calls)); + + T--; + } + + return 0; +} + +int fibonacci(int n, int *calls){ + + if(n == 0){ + (*calls)++; + return 0; + } + else if(n == 1){ + (*calls)++; + return 1; + } + else{ + (*calls)++; + return fibonacci(n - 1, calls) + fibonacci(n - 2, calls); + } +} diff --git a/1035.c b/1035.c new file mode 100644 index 0000000..35939b7 --- /dev/null +++ b/1035.c @@ -0,0 +1,17 @@ +#include + +int main() +{ + int A, B, C, D; + + scanf("%i %i %i %i", &A, &B, &C, &D); + + if(B>C && D>A && C+D>A+B && C>0 && B>0 && A%2==0){ + printf("Valores aceitos\n"); + } + else{ + printf("Valores nao aceitos\n"); + } + + return 0; +} diff --git a/1036.c b/1036.c new file mode 100644 index 0000000..d6ff827 --- /dev/null +++ b/1036.c @@ -0,0 +1,22 @@ +#include +#include + +int main() +{ + double A, B, C, R1, R2; + + scanf("%lf %lf %lf", &A, &B, &C); + + if(A<=0 || (pow(B,2)- 4*A*C)<0){ + printf("Impossivel calcular\n"); + } + else{ + + R1= (B*(-1)+sqrt((pow(B,2)- 4*A*C)))/(A*2); + R2= (B*(-1)-sqrt((pow(B,2)- 4*A*C)))/(A*2); + + printf("R1 = %.5lf\nR2 = %.5lf\n", R1, R2); + } + + return 0; +} diff --git a/1037.c b/1037.c new file mode 100644 index 0000000..5dae83b --- /dev/null +++ b/1037.c @@ -0,0 +1,20 @@ +#include + +int main() +{ +float valor; + +scanf("%f", &valor); + +if(valor>=0 && valor<=25){ + printf("Intervalo [0,25]\n");} +else if(valor>25 && valor<=50){ + printf("Intervalo (25,50]\n");} +else if(valor>50 && valor<=75){ + printf("Intervalo (50,75]\n");} +else if(valor>75 && valor<=100){ + printf("Intervalo (75,100]\n");} +else{ + printf("Fora de intervalo\n");} + +} diff --git a/1038.c b/1038.c new file mode 100644 index 0000000..185f70c --- /dev/null +++ b/1038.c @@ -0,0 +1,19 @@ +#include + +int main() +{ +int n, cod; +float total; + +scanf("%i %i", &cod, &n); + +switch(cod){ + case 1: total= n*4; break; + case 2: total= n*4.50; break; + case 3: total= n*5; break; + case 4: total= n*2; break; + case 5: total= n*1.50; break; +} + +printf("Total: R$ %.2f\n", total); +} diff --git a/1040.c b/1040.c new file mode 100644 index 0000000..3290182 --- /dev/null +++ b/1040.c @@ -0,0 +1,37 @@ +#include + +int main() +{ +float N1, N2, N3, N4, media, exame; + +scanf("%f %f %f %f", &N1, &N2, &N3, &N4); + +media= (N1*2 + N2*3 + N3*4 + N4)/10; +printf("Media: %.1f\n", media); + +if(media>=7){ + printf("Aluno aprovado.\n"); +} + +else if(media<5){ + printf("Aluno reprovado.\n"); +} + +else{ + printf("Aluno em exame.\n"); + scanf("%f", &exame); + printf("Nota do exame: %.1f\n", exame); + media= (media + exame)/2; + + if(media>= 5){ + printf("Aluno aprovado.\n"); + } + else{ + printf("Aluno reprovado.\n"); + } + printf("Media final: %.1f\n", media); + +} + + return 0; +} diff --git a/1041.c b/1041.c new file mode 100644 index 0000000..edcfdea --- /dev/null +++ b/1041.c @@ -0,0 +1,32 @@ +#include + +int 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 X\n"); +} +else if(x==0 && y!=0){ +printf("Eixo Y\n"); +} +else{ +if(x>0 && y>0){ +printf("Q1\n"); +} +if(x<0 && y>0){ +printf("Q2\n"); +} +if(x<0 && y<0){ +printf("Q3\n"); +} +if(x>0 && y<0){ +printf("Q4\n"); +}} + return 0; +} diff --git a/1042.c b/1042.c new file mode 100644 index 0000000..3c93e8d --- /dev/null +++ b/1042.c @@ -0,0 +1,49 @@ +#include +#define max 3 + +int main() +{ + int v[max]; + int guarda[max]; + int aux, i= 0; + + while(i<3){ + scanf("%i", &v[i]); + guarda[i]= v[i]; + i++; + } + + while(v[0]>v[1] || v[0]>v[2] || v[1]>v[2]){ + + if(v[0]>v[1]){ + aux = v[1]; + v[1] = v[0]; + v[0] = aux; + } + + if(v[1]>v[2]){ + aux= v[2]; + v[2]= v[1]; + v[1]= aux; + } + } + + i=0; + + while(i<3){ + printf("%i\n", v[i]); + i++; + } + + printf("\n"); + + i=0; + + while(i<3){ + printf("%i\n", guarda[i]); + i++; + } + + + return 0; +} diff --git a/1043.c b/1043.c new file mode 100644 index 0000000..7f3d46c --- /dev/null +++ b/1043.c @@ -0,0 +1,16 @@ +#include +#include + +int main() +{ +float A, B, C; + +scanf("%f %f %f", &A, &B, &C); + +if(A>abs(B-C) && Aabs(A-C) && Babs(A-B) && C + +int main() { + + int A, B; + + scanf("%i %i", &A, &B); + + if(A%B == 0 || B%A == 0){ + printf("Sao Multiplos\n"); + } + else{ + printf("Nao sao Multiplos\n"); + } + return 0; +} diff --git a/1045.c b/1045.c new file mode 100644 index 0000000..e8c931e --- /dev/null +++ b/1045.c @@ -0,0 +1,34 @@ +#include + +int main() +{ + double A, B, C; + + scanf("%lf %lf %lf", &A, &B, &C); + + if(A >= B+C || B >= A+C || C >= A+B){ + printf("NAO FORMA TRIANGULO\n"); + } + else{ + if(A*A== B*B + C*C || B*B== A*A + C*C || C*C== A*A + B*B){ + printf("TRIANGULO RETANGULO\n"); + } + else if(A*A > B*B + C*C || B*B > A*A + C*C || C*C> A*A + B*B){ + printf("TRIANGULO OBTUSANGULO\n"); + } + else if(A*A < B*B + C*C && B*B< A*A + C*C && C*C< A*A + B*B){ + printf("TRIANGULO ACUTANGULO\n");} + } + + + + if(A == B && A == C){ + printf("TRIANGULO EQUILATERO\n"); + } + else if(A == B && C != A || B == C && A != B || C == A && B != C){ + printf("TRIANGULO ISOSCELES\n"); + } + + + return 0; +} diff --git a/1046.c b/1046.c new file mode 100644 index 0000000..9e584e5 --- /dev/null +++ b/1046.c @@ -0,0 +1,18 @@ +#include + +int main() +{ + int i, f, horas; + + scanf("%i %i", &i, &f); + + if(f<=i){ + horas= (f+24) - i; + } + else{ + horas= f - i; + } + printf("O JOGO DUROU %i HORA(S)\n", horas); + + return 0; +} diff --git a/1047.c b/1047.c new file mode 100644 index 0000000..16736dc --- /dev/null +++ b/1047.c @@ -0,0 +1,26 @@ +#include + +int main() +{ + int h1, m1, h2, m2, sub, horas, minutos; + + scanf("%i %i %i %i", &h1, &m1, &h2, &m2); + + m1 = m1 + h1*60; + m2 = m2 + h2*60; + + sub = m2- m1; + + if(m2 <= m1){ + sub= m2+1440 - m1; + horas= sub/60; + minutos= sub%60; + } + else{ + horas= sub/60; + minutos= sub%60; + } + +printf("O JOGO DUROU %i HORA(S) E %i MINUTO(S)\n", horas, minutos); + +} diff --git a/1048.c b/1048.c new file mode 100644 index 0000000..81d6707 --- /dev/null +++ b/1048.c @@ -0,0 +1,38 @@ +#include + +int main() +{ +float salario, reajuste; +int percentual; + +scanf("%f", &salario); + +if(salario >=0 && salario <= 400){ + reajuste = salario * 0.15; + salario = reajuste + salario; + percentual = 15; +} +else if(salario >400 && salario <= 800){ + reajuste = salario * 0.12; + salario = reajuste + salario; + percentual = 12; +} +else if(salario > 800 && salario <= 1200){ + reajuste = salario * 0.10; + salario = reajuste + salario; + percentual = 10; +} +else if(salario > 1200 && salario <= 2000){ + reajuste = salario * 0.07; + salario = reajuste + salario; + percentual= 7; +} +else if(salario > 2000){ + reajuste = salario * 0.04; + salario = reajuste + salario; + percentual = 4; +} + +printf("Novo salario: %.2f\nReajuste ganho: %.2f\nEm percentual: %i %\n", salario, reajuste, percentual); + return 0; +} diff --git a/1049.c b/1049.c new file mode 100644 index 0000000..f44bcf3 --- /dev/null +++ b/1049.c @@ -0,0 +1,51 @@ +#include + +int main() +{ + char l1[20], l2[20], l3[30]; + + scanf("%s", l1); + scanf("%s", l2); + scanf("%s", l3); + + if(l1[0]=='v'){ + if(l2[0]== 'a'){ + if(l3[0]== 'c'){ + printf("aguia\n"); + } + else{ + printf("pomba\n"); + } + } + + else if(l2[0]== 'm'){ + if(l3[0]== 'o'){ + printf("homem\n"); + } + else{ + printf("vaca\n"); + } + } + } + + if(l1[0]== 'i'){ + if(l2[0]== 'i'){ + if(l3[2]== 'm'){ + printf("pulga\n"); + } + else{ + printf("lagarta\n"); + } + } + else if(l2[0]== 'a'){ + if(l3[0]== 'h'){ + printf("sanguessuga\n"); + } + else{ + printf("minhoca\n"); + } + } + } + + return 0; +} diff --git a/1050.c b/1050.c new file mode 100644 index 0000000..485f09b --- /dev/null +++ b/1050.c @@ -0,0 +1,38 @@ +#include + +int main() +{ + int DDD; + + scanf("%i", &DDD); + + if(DDD==61){ + printf("Brasilia\n"); + } + else if(DDD==71){ + printf("Salvador\n"); + } + else if(DDD==11){ + printf("Sao Paulo\n"); + } + else if(DDD==21){ + printf("Rio de Janeiro\n"); + } + else if(DDD==32){ + printf("Juiz de Fora\n"); + } + else if(DDD==19){ + printf("Campinas\n"); + } + else if(DDD==27){ + printf("Vitoria\n"); + } + else if(DDD==31){ + printf("Belo Horizonte\n"); + } + else{ + printf("DDD nao cadastrado\n"); + } + + return 0; +} diff --git a/1051.c b/1051.c new file mode 100644 index 0000000..2006098 --- /dev/null +++ b/1051.c @@ -0,0 +1,26 @@ +#include + +int main() +{ +float salario, total; + +scanf("%f", &salario); + +if(salario>=0 && salario<=2000){ + printf("Isento\n"); +} +if(salario>2000 && salario<=3000){ + total= (salario-2000)*0.08; + printf("R$ %.2f\n", total); +} +if(salario>3000 && salario<=4500){ + total= 1000*0.08 + (salario-3000)*0.18; + printf("R$ %.2f\n", total); +} +if(salario>4500){ + total= 1000*0.08 + 1500*0.18 + (salario-4500)*0.28; + printf("R$ %.2f\n", total); +} + + return 0; +} diff --git a/1052.c b/1052.c new file mode 100644 index 0000000..643446d --- /dev/null +++ b/1052.c @@ -0,0 +1,24 @@ +#include + +int main() { + + int M; + + scanf("%i", &M); + + switch(M){ + case 1: printf("January\n"); break; + case 2: printf("February\n"); break; + case 3: printf("March\n"); break; + case 4: printf("April\n"); break; + case 5: printf("May\n"); break; + case 6: printf("June\n"); break; + case 7: printf("July\n"); break; + case 8: printf("August\n"); break; + case 9: printf("September\n"); break; + case 10: printf("October\n"); break; + case 11: printf("November\n"); break; + case 12: printf("December\n"); break; + } + return 0; +} diff --git a/1059.c b/1059.c new file mode 100644 index 0000000..77f759e --- /dev/null +++ b/1059.c @@ -0,0 +1,15 @@ +#include + +int main() { + + int i = 1; + + while(i <= 100){ + if(i%2 == 0){ + printf("%i\n", i); + } + i++; + } + + return 0; +} diff --git a/1060.c b/1060.c new file mode 100644 index 0000000..101d5c3 --- /dev/null +++ b/1060.c @@ -0,0 +1,19 @@ +#include + +int main() +{ + int a, b, c, d, e, f, positivo; + + scanf("%i %i %i %i %i %i", &a, &b, &c, &d, &e, &f); + + positivo= 0; + + if(a>0){positivo+= 1;} + if(b>0){positivo+= 1;} + if(c>0){positivo+= 1;} + if(d>0){positivo+= 1;} + if(e>0){positivo+= 1;} + if(f>0){positivo+= 1;} + + printf("%i valores positivos\n", positivo); +} diff --git a/1061.c b/1061.c new file mode 100644 index 0000000..fd0dceb --- /dev/null +++ b/1061.c @@ -0,0 +1,83 @@ +#include + +int main() { + + int Dia1, Dia2, DiaResultado = 0, HoraResultado = 0, MinutoResultado = 0, diferencaSEC = 0; + int hora1, min1, sec1, hora2, min2, sec2; + char day1[10], day2[10], string1[20], string2[20]; + + fgets(day1, 10, stdin); + sscanf(day1,"Dia %i", &Dia1); + getchar(); + + fgets(string1, 20, stdin); + sscanf(string1,"%i : %i : %i", &hora1, &min1, &sec1); + + fgets(day2, 10, stdin); + sscanf(day2,"Dia %i", &Dia2); + getchar(); + + fgets(string2, 20, stdin); + sscanf(string2,"%i : %i : %i", &hora2, &min2, &sec2); + + + diferencaSEC = ((hora2*60*60) + (min2*60) + sec2) - ((hora1*60*60) + (min1*60) + sec1); + + + if(diferencaSEC >= 0){ + + while(diferencaSEC >= (3600)){ + if(HoraResultado < 24){ + HoraResultado++; + diferencaSEC -= 3600; + } + else{ + HoraResultado = 0; + } + } + + while(diferencaSEC >= 60){ + if(MinutoResultado < 60){ + diferencaSEC -= 60; + MinutoResultado++; + } + else{ + MinutoResultado = 0; + } + } + + DiaResultado = Dia2 - Dia1; + } + else{ + diferencaSEC = 24*60*60 + diferencaSEC; + + while(diferencaSEC >= (3600)){ + if(HoraResultado < 24){ + HoraResultado++; + diferencaSEC -= 3600; + } + else{ + HoraResultado = 0; + } + } + + while(diferencaSEC >= 60){ + if(MinutoResultado < 60){ + diferencaSEC -= 60; + MinutoResultado++; + } + else{ + MinutoResultado = 0; + } + } + + DiaResultado = (Dia2 - Dia1) - 1; + } + + + printf("%i dia(s)\n%i hora(s)\n%i minuto(s)\n%i segundo(s)\n", DiaResultado, HoraResultado, MinutoResultado, diferencaSEC); + + return 0; +} + + diff --git a/1064.c b/1064.c new file mode 100644 index 0000000..e76db49 --- /dev/null +++ b/1064.c @@ -0,0 +1,23 @@ +#include + +int main() { + + int n=1, j= 0; + double media, numero, variavel=0; + + while(n<=6){ + scanf("%lf", &numero); + + if(numero>0){ + j++; + variavel+= numero ; + media=variavel/j; + } + n++; + } + + printf("%i valores positivos\n", j); + printf("%.1lf\n", media); + + return 0; +} diff --git a/1065.c b/1065.c new file mode 100644 index 0000000..713fb69 --- /dev/null +++ b/1065.c @@ -0,0 +1,18 @@ +#include + +int main() { + + int a, b, c, d, e; + int i=0; + + scanf("%i %i %i %i %i", &a, &b, &c, &d, &e); + + if(a%2==0){i++;} + if(b%2==0){i++;} + if(c%2==0){i++;} + if(d%2==0){i++;} + if(e%2==0){i++;} + + printf("%i valores pares\n", i); + return 0; +} diff --git a/1066.c b/1066.c new file mode 100644 index 0000000..806ac30 --- /dev/null +++ b/1066.c @@ -0,0 +1,33 @@ +#include + +int main() { + + int n=1, numero, par=0, impar=0, positivo= 0, negativo=0; + + while(n<=5){ + scanf("%i", &numero); + n++; + + if(numero%2 == 0){ + par++; + } + else{ + impar++; + } + + if(numero > 0){ + positivo++; + } + + if(numero < 0){ + negativo++; + } + } + + printf("%i valor(es) par(es)\n", par); + printf("%i valor(es) impar(es)\n", impar); + printf("%i valor(es) positivo(s)\n", positivo); + printf("%i valor(es) negativo(s)\n", negativo); + + return 0; +} diff --git a/1067.c b/1067.c new file mode 100644 index 0000000..430b4ac --- /dev/null +++ b/1067.c @@ -0,0 +1,17 @@ +#include + +int main() { + + int X, i=1; + + scanf("%i", &X); + + while(X>=i){ + if(i%2!=0){ + printf("%i\n", i); + } + i++; + } + + return 0; +} diff --git a/1068.c b/1068.c new file mode 100644 index 0000000..cd1f0b4 --- /dev/null +++ b/1068.c @@ -0,0 +1,31 @@ +#include +#include + +int main() { + +char string[1001]; + + while(fgets(string, 1001, stdin)){ + + int parenteses = 0, tamanho = 0, fechamentoAntesDeAbertura = 0; + + tamanho = strlen(string); + + for(int i = 0; i < tamanho; i++){ + if(string[i] == '(') + parenteses++; + else if(string[i] == ')'){ + if(parenteses <= 0){ + fechamentoAntesDeAbertura++; + break; + } + parenteses--; + } + } + + (fechamentoAntesDeAbertura > 0 || parenteses > 0)?printf("incorrect\n"):printf("correct\n"); + + } + + return 0; +} diff --git a/1070.c b/1070.c new file mode 100644 index 0000000..679a88c --- /dev/null +++ b/1070.c @@ -0,0 +1,17 @@ +#include + +int main() { + + int X, i= 6; + scanf("%i", &X); + + while(i!=0){ + if(X%2!=0){ + i--; + printf("%i\n", X); + } + X++; + } + + return 0; +} diff --git a/1071.c b/1071.c new file mode 100644 index 0000000..a61ff45 --- /dev/null +++ b/1071.c @@ -0,0 +1,31 @@ +#include + +int main() { + + int X, Y, impar = 0; + + scanf("%i %i", &X, &Y); + + if(X > Y){ + Y++; + while(X>Y){ + if(Y%2!=0){ + impar+=Y; + } + Y++; + } + } + + else if(Y > X){ + X++; + while(Y > X){ + if(X%2 != 0){ + impar+=X; + } + X++; + } + } + + printf("%i\n", impar); + return 0; +} diff --git a/1072.c b/1072.c new file mode 100644 index 0000000..22c16cc --- /dev/null +++ b/1072.c @@ -0,0 +1,20 @@ +#include + +int main() { + + int N, X, i=1, in=0, out=0; + + scanf("%i", &N); + + while(N >= i){ + scanf("%i", &X); + + if(X>=10 && X<=20){in++;} + else{out++;} + i++; + } + + printf("%i in\n", in); + printf("%i out\n", out); + return 0; +} diff --git a/1073.c b/1073.c new file mode 100644 index 0000000..71ab8be --- /dev/null +++ b/1073.c @@ -0,0 +1,16 @@ +#include + +int main() { + + int N,i=1; + + scanf("%i", &N); + + while(N>=i){ + if(i%2 == 0){ + printf("%i^2 = %i\n", i, i*i); + } + i++; + } + return 0; +} diff --git a/1074.c b/1074.c new file mode 100644 index 0000000..8ae4562 --- /dev/null +++ b/1074.c @@ -0,0 +1,31 @@ +#include + +int main() { + + int N, X, i=1; + + scanf("%i", &N); + + while(N>=i){ + scanf("%i", &X); + if(X!=0){ + if(X%2==0){ + printf("EVEN "); + } + if(X%2!=0){ + printf("ODD "); + } + if(X>0){ + printf("POSITIVE\n"); + } + if(X<0){ + printf("NEGATIVE\n"); + } + } + else{ + printf("NULL\n"); + } + i++; + } + return 0; +} diff --git a/1075.c b/1075.c new file mode 100644 index 0000000..7a49c63 --- /dev/null +++ b/1075.c @@ -0,0 +1,17 @@ +#include + +int main() { + + int N, i=1; + + scanf("%i", &N); + + while(i<10000){ + if(i%N==2){ + printf("%i\n", i); + } + i++; + } + + return 0; +} diff --git a/1078.c b/1078.c new file mode 100644 index 0000000..00f1058 --- /dev/null +++ b/1078.c @@ -0,0 +1,21 @@ +#include + +int main() { + + int N; + + scanf("%i", &N); + + printf("1 x %i = %i\n", N, N*1); + printf("2 x %i = %i\n", N, N*2); + printf("3 x %i = %i\n", N, N*3); + printf("4 x %i = %i\n", N, N*4); + printf("5 x %i = %i\n", N, N*5); + printf("6 x %i = %i\n", N, N*6); + printf("7 x %i = %i\n", N, N*7); + printf("8 x %i = %i\n", N, N*8); + printf("9 x %i = %i\n", N, N*9); + printf("10 x %i = %i\n", N, N*10); + + return 0; +} diff --git a/1079.c b/1079.c new file mode 100644 index 0000000..d59af45 --- /dev/null +++ b/1079.c @@ -0,0 +1,18 @@ +#include + +int main() { + + int N; + float a, b, c, media; + + scanf("%i", &N); + + while(N>=1){ + scanf("%f %f %f", &a, &b, &c); + media= (a*2 + b*3 + c*5)/10; + printf("%.1f\n", media); + N--; + } + + return 0; +} diff --git a/1080.c b/1080.c new file mode 100644 index 0000000..d475827 --- /dev/null +++ b/1080.c @@ -0,0 +1,18 @@ +#include + +int main() { + + int n, i=1, m=0, p; + + while(i<=100){ + scanf("%i", &n); + if(n>m){ + m=n; + p=i; + } + i++; + } + + printf("%i\n%i\n", m, p); + return 0; +} diff --git a/1094.c b/1094.c new file mode 100644 index 0000000..740223c --- /dev/null +++ b/1094.c @@ -0,0 +1,48 @@ +#include + +int main() { + + int N, quant, i=0, total=0, R=0, C=0, S=0; + char tipo; + float pc, pr, ps, c, r, s; + + scanf("%i", &N); + + while(i + +int main() { + + int i=1, j=60; + + while(j>=0){ + printf("I=%i J=%i\n", i, j); + j-=5; + i+=3; + } + + return 0; +} diff --git a/1096.c b/1096.c new file mode 100644 index 0000000..5e802f6 --- /dev/null +++ b/1096.c @@ -0,0 +1,17 @@ +#include + +int main() { + + int i=1, j=7, n=1; + + + while(i<=9){ + while(n<=3){ + printf("I=%i J=%i\n", i, j); + n++; + j--; + } + n=1; i=i+2; j=7; + } + return 0; +} diff --git a/1097.c b/1097.c new file mode 100644 index 0000000..19d38bf --- /dev/null +++ b/1097.c @@ -0,0 +1,17 @@ +#include + +int main() { + + int i=1, j=7, n=1; + + + while(i<=9){ + while(n<=3){ + printf("I=%i J=%i\n", i, j); + n++; + j--; + } + n=1; i=i+2; j=j+5; + } + return 0; +} diff --git a/1098.c b/1098.c new file mode 100644 index 0000000..280ee00 --- /dev/null +++ b/1098.c @@ -0,0 +1,23 @@ +#include + +int main() { + + float i=0, j=1, n=1; + int dez=0; + + + while(i<=2.1){ + while(n<=3){ + if(dez==0 || dez==10 || dez==20){ + printf("I=%.0f J=%.0f\n", i, j); + } + else{ + printf("I=%.1f J=%.1f\n", i, j); + } + j+=1; + n++; + } + n=1; i=i+0.2; j= 1+ i, dez+=2; + } + return 0; +} diff --git a/1099.c b/1099.c new file mode 100644 index 0000000..9614521 --- /dev/null +++ b/1099.c @@ -0,0 +1,38 @@ +#include + +int main() { + + int N, i=1, x, y, impar; + + scanf("%i", &N); + + while(N>=i){ + scanf("%i %i", &x, &y); + impar=0; + + if(x>y){ + y++; + while(x>y){ + if(y%2!=0){ + impar+=y; + } + y++; + } + } + + else if(y>x){ + x++; + while(y>x){ + if(x%2!=0){ + impar+=x; + } + x++; + } + } + + printf("%i\n", impar); + i++; + } + + return 0; +} diff --git a/1101.c b/1101.c new file mode 100644 index 0000000..0992385 --- /dev/null +++ b/1101.c @@ -0,0 +1,34 @@ +#include + +int main() { + + int M=1, N=1, soma; + + + while(M>0 && N>0){ + scanf("%i %i", &M, &N); + soma=0; + + if(M>0 && N>0){ + + if(M>N){ + while(M>=N){ + soma+=N; + printf("%i ", N); + N++; + } + } + + else if(N>M){ + while(N>=M){ + soma+=M; + printf("%i ", M); + M++; + } + } + printf("Sum=%i\n", soma); + } + } + + return 0; +} diff --git a/1113.c b/1113.c new file mode 100644 index 0000000..eb586e4 --- /dev/null +++ b/1113.c @@ -0,0 +1,17 @@ +#include + +int main() { + + int X,Y; + + do{ + + scanf("%i %i", &X, &Y); + if(Y>X){printf("Crescente\n");} + if(X>Y){printf("Decrescente\n");} + + }while(X!=Y); + + + return 0; +} diff --git a/1114.c b/1114.c new file mode 100644 index 0000000..294e751 --- /dev/null +++ b/1114.c @@ -0,0 +1,18 @@ +#include + +int main() { + + int s; + + do{ + scanf("%i", &s); + if(s==2002){ + printf("Acesso Permitido\n"); + } + else{ + printf("Senha Invalida\n"); + } + }while(s!=2002); + + return 0; +} diff --git a/1115.c b/1115.c new file mode 100644 index 0000000..6abe02c --- /dev/null +++ b/1115.c @@ -0,0 +1,23 @@ +#include + +int main() + { + int x=1, y=1, N; + + while(x!=0 && y!=0){ + + scanf("%i%i",&x,&y); + + if(x>0 && y>0) + printf("primeiro\n"); + else if(x<0 && y>0) + printf("segundo\n"); + else if(x<0 && y<0) + printf("terceiro\n" ); + else if(x>0 && y<0) + printf("quarto\n"); + + } + + return 0; +} diff --git a/1116.c b/1116.c new file mode 100644 index 0000000..00e3036 --- /dev/null +++ b/1116.c @@ -0,0 +1,24 @@ +#include + +int main() { + + int N, X, Y, i=1; + float a,b, divisao; + + + scanf("%i", &N); + + while(N>=i){ + scanf("%i %i", &X, &Y); + a=X; b=Y; + if(Y==0){ + printf("divisao impossivel\n"); + } + else{ + divisao= a/b; + printf("%.1f\n", divisao); + } + i++; + } + return 0; +} diff --git a/1117.c b/1117.c new file mode 100644 index 0000000..d734ced --- /dev/null +++ b/1117.c @@ -0,0 +1,29 @@ +#include + +int main() { + + float a, b, media; + + scanf("%f", &a); + + while(a>10 || a<0){ + if(a>10 || a<0){ + printf("nota invalida\n"); + scanf("%f", &a); + } + } + + scanf("%f", &b); + + while(b>10 || b<0){ + if(b>10 || b<0){ + printf("nota invalida\n"); + scanf("%f", &b); + } + } + + media= (a+b)/2; + printf("media = %.2f\n", media); + + return 0; +} diff --git a/1118V1.c b/1118V1.c new file mode 100644 index 0000000..cd1c647 --- /dev/null +++ b/1118V1.c @@ -0,0 +1,40 @@ +#include + +int main() { + + float a, b, media; + int continua; + + do{ + scanf("%f", &a); + + while(a>10 || a<0){ + if(a>10 || a<0){ + printf("nota invalida\n"); + scanf("%f", &a); + } + } + scanf("%f", &b); + + while(b>10 || b<0){ + if(b>10 || b<0){ + printf("nota invalida\n"); + scanf("%f", &b); + } + } + + media= (a+b)/2; + printf("media = %.2f\n", media); + + printf("novo calculo (1-sim 2-nao)\n"); + scanf("%i", &continua); + + while(continua>2 || continua<1){ + printf("novo calculo (1-sim 2-nao)\n"); + scanf("%i", &continua); + } + + }while(continua==1); + + return 0; +} diff --git a/1118V2.c b/1118V2.c new file mode 100644 index 0000000..2c1684d --- /dev/null +++ b/1118V2.c @@ -0,0 +1,38 @@ +#include + +int main() { + +float a, b, media; +int continua; + +do{ + scanf("%f", &a); + + while(a>10 || a<0){ + if(a>10 || a<0){ + printf("nota invalida\n"); + scanf("%f", &a); + } + } + scanf("%f", &b); + + while(b>10 || b<0){ + if(b>10 || b<0){ + printf("nota invalida\n"); + scanf("%f", &b); + } + } + + media= (a+b)/2; + printf("media = %.2f\n", media); + + continua= 0; + + while(continua>2 || continua<1){ + printf("novo calculo (1-sim 2-nao)\n"); + scanf("%i", &continua); + } +}while(continua==1); + + return 0; +} diff --git a/1131.c b/1131.c new file mode 100644 index 0000000..605cb03 --- /dev/null +++ b/1131.c @@ -0,0 +1,38 @@ +#include + +int main() { + + int gre, inte, i=0, g=0, e=0, j=0, n; + + while(n!=2){ + j++; + scanf("%i %i", &inte, &gre); + + if(inte>gre){ + i++; + } + if(gre>inte){ + g++; + } + if(gre==inte){ + e++; + } + + printf("Novo grenal (1-sim 2-nao)\n"); + scanf("%i", &n); + } + + printf("%i grenais\nInter:%i\nGremio:%i\nEmpates:%i\n", j, i, g, e); + + if(g>i){ + printf("Gremio venceu mais\n"); + } + if(g + +int main() { + + int x,y, soma=0; + scanf("%i %i", &x, &y); + + + if(x>=y){ + while(x>=y){ + if(y%13!=0){ + soma+=y; + } + y++; + } + } + + else{ + while(y>=x){ + if(x%13!=0){ + soma+=x; + } + x++; + } + } + + printf("%i\n", soma); + return 0; +} diff --git a/1133.c b/1133.c new file mode 100644 index 0000000..af85077 --- /dev/null +++ b/1133.c @@ -0,0 +1,27 @@ +#include + +int main() { + + int x, y; + + scanf("%i %i", &x, &y); + + if(x>=y){ + while(x>y){ + y++; + if(y%5==2 || y%5==3){ + printf("%i\n", y); + } + } + } + + if(y>=x){ + while(y>x){ + x++; + if(x%5==2 || x%5==3){ + printf("%i\n", x);} + } + } + + return 0; +} diff --git a/1134.c b/1134.c new file mode 100644 index 0000000..48c9537 --- /dev/null +++ b/1134.c @@ -0,0 +1,18 @@ +#include + +int main() { + + int n=1, a=0, g=0, d=0; + + while(n!=4){ + scanf("%i", &n); + switch(n){ + case 1: a++; break; + case 2: g++; break; + case 3: d++; break; + } + } + printf("MUITO OBRIGADO\nAlcool: %i\nGasolina: %i\nDiesel: %i\n", a, g, d); + + return 0; +} diff --git a/1142.c b/1142.c new file mode 100644 index 0000000..a6882d9 --- /dev/null +++ b/1142.c @@ -0,0 +1,16 @@ +#include + +int main() { + + int N, i=1, a=1; + + scanf("%i", &N); + + while(N>=i){ + printf("%i %i %i PUM\n", a, a+1, a+2); + a+=4; + i++; + } + + return 0; +} diff --git a/1143.c b/1143.c new file mode 100644 index 0000000..c0caf45 --- /dev/null +++ b/1143.c @@ -0,0 +1,15 @@ +#include + +int main() { + + int N, i=1; + + scanf("%i", &N); + + while(N>=i){ + printf("%i %i %i\n", i, i*i, i*i*i); + i++; + } + + return 0; +} diff --git a/1144.c b/1144.c new file mode 100644 index 0000000..da09e15 --- /dev/null +++ b/1144.c @@ -0,0 +1,22 @@ +#include + +int main() +{ + + int a= 1, n; + + scanf("%i", &n); + + while(n>0){ + + printf("%i %i %i\n", a, a*a, a*a*a); + + printf("%i %i %i\n", a, (a*a)+1, (a*a*a)+1); + + a= a+1; + + n--; + } + + return 0; +} diff --git a/1145.c b/1145.c new file mode 100644 index 0000000..6b61e6c --- /dev/null +++ b/1145.c @@ -0,0 +1,26 @@ +#include + +int main() +{ + int x, y, i=1, j=1; + + scanf("%i %i", &x, &y); + + while(y>=i){ + j= 1; + + while(x>=j && y>=i){ + if(x==j){ + printf("%i\n", i); + } + else{ + printf("%i ", i);} + + i++; + j++; + } + + } + + return 0; +} diff --git a/1146.c b/1146.c new file mode 100644 index 0000000..42c5ee5 --- /dev/null +++ b/1146.c @@ -0,0 +1,21 @@ +#include + +int main() { + +int X=1, i=1; + + while(X!=0){ + scanf("%i", &X); + while(X>i && X!=0){ + printf("%i ", i); + i++; + } + if(X==i && X!=0){ + printf("%i\n", i); + } + i=1; + } + + + return 0; +} diff --git a/1149.c b/1149.c new file mode 100644 index 0000000..cb41708 --- /dev/null +++ b/1149.c @@ -0,0 +1,21 @@ +#include + +int main() { + + int a, n, i=0, valor=0; + + scanf("%i %i", &a, &n); + + while(n<=0){ + scanf("%i", &n); + } + + while(n>i){ + valor+= a+i; + + i++; + } + + printf("%i\n", valor); + return 0; +} diff --git a/1150.c b/1150.c new file mode 100644 index 0000000..370782f --- /dev/null +++ b/1150.c @@ -0,0 +1,22 @@ +#include + +int main() { + + int x, z, n=0, soma=0; + + scanf("%i %i", &x, &z); + + while(z<=x){ + scanf("%i", &z); + } + + + while(soma + +int main() { + + int N, i=0, j=1; + + scanf("%i", &N); + + while(N>1){ + + if(N>1){ + printf("%i ", i); + i= i+j; + N--; + } + if(N>1){ + printf("%i ", j); + j= j+i; + N--; + } + } + + if(N==1){ + if(i>j){ + printf("%i\n", j); + } + else{ + printf("%i\n", i); + } + } + return 0; +} diff --git a/1153.c b/1153.c new file mode 100644 index 0000000..8fa45c3 --- /dev/null +++ b/1153.c @@ -0,0 +1,16 @@ +#include + +int main() { + + int n, mult=1; + + scanf("%i", &n); + + while(n>0){ + mult*= n; + n--; + } + + printf("%i\n", mult); + return 0; +} diff --git a/1154.c b/1154.c new file mode 100644 index 0000000..7e48ad0 --- /dev/null +++ b/1154.c @@ -0,0 +1,22 @@ +#include + +int main() +{ + int n=0; + float media, idade, soma=0; + + scanf("%f", &idade); + + do{ + soma+=idade; + n++; + + scanf("%f", &idade); + + }while(idade>=0); + + media= soma/n; + printf("%.2f\n", media); + + return 0; +} diff --git a/1155.c b/1155.c new file mode 100644 index 0000000..c1d39a4 --- /dev/null +++ b/1155.c @@ -0,0 +1,15 @@ +#include + +int main() { + + int n=1; + float soma=0; + + while(100>=n){ + soma+= 1.0/n; + n++; + } + + printf("%.2f\n", soma); + return 0; +} diff --git a/1156.c b/1156.c new file mode 100644 index 0000000..988a37d --- /dev/null +++ b/1156.c @@ -0,0 +1,16 @@ +#include + +int main() { + + int n=1; + float soma=0, d= 1; + + while(39>=n){ + soma+= n/d; + n+=2; + d*=2; + } + + printf("%.2f\n", soma); + return 0; +} diff --git a/1157.c b/1157.c new file mode 100644 index 0000000..45a4746 --- /dev/null +++ b/1157.c @@ -0,0 +1,17 @@ +#include + +int main() { + + int N, i=1; + + scanf("%i", &N); + + while(N>=i){ + if(N%i==0){ + printf("%i\n", i); + } + i++; + } + + return 0; +} diff --git a/1158.c b/1158.c new file mode 100644 index 0000000..128ec5f --- /dev/null +++ b/1158.c @@ -0,0 +1,28 @@ +#include + +int main() { + + int n, x, y, impar; + + scanf("%i", &n); + + while(n>0){ + scanf("%i %i", &x, &y); + + impar= 0; + + while(y>0){ + + if(x%2!=0){ + impar+=x; + y--; + } + x+=1; + } + + printf("%i\n", impar); + n--; + } + + return 0; +} diff --git a/1159.c b/1159.c new file mode 100644 index 0000000..8f164bf --- /dev/null +++ b/1159.c @@ -0,0 +1,27 @@ +#include + +int main() { + + int x, n, soma; + + scanf("%i", &x); + + do{ + n=0; + soma=0; + + while(n<5){ + if(x%2==0){ + soma+=x; + n++; + } + x++; + } + printf("%i\n", soma); + + scanf("%i", &x); + + }while(x!=0); + + return 0; +} diff --git a/1160.c b/1160.c new file mode 100644 index 0000000..8484776 --- /dev/null +++ b/1160.c @@ -0,0 +1,35 @@ +#include + +int main() { + + long n, a, b, anos; + double ca, cb, multA, multB; + + scanf("%li", &n); + + while(n>0){ + scanf("%li %li", &a, &b); + scanf("%lf %lf", &ca, &cb); + + anos=0; + + while(a<=b && anos<101){ + multA= (ca*a)/100.0; + multB= (cb*b)/100.0; + a+= multA; + b+= multB; + anos++; + } + + if(anos>100){ + printf("Mais de 1 seculo.\n"); + } + else{ + printf("%li anos.\n", anos); + } + + n--; + } + + return 0; +} diff --git a/1161.c b/1161.c new file mode 100644 index 0000000..c7db759 --- /dev/null +++ b/1161.c @@ -0,0 +1,36 @@ +#include + +int main() { + + long long fatorial1, fatorial2, soma; + int M, N; + + while(scanf("%i %i", &M, &N)!=EOF && M>=0 && N>=0 && M<=20 && N<=20){ + fatorial1= M; + fatorial2= N; + + if(M==0){ + fatorial1= 1; + } + if(N==0){ + fatorial2= 1; + } + + while(M>1){ + fatorial1*= (M-1); + M--; + } + + while(N>1){ + fatorial2*= (N-1); + N--; + } + + soma= fatorial1+ fatorial2; + printf("%lli\n", soma); + + } + + + return 0; +} diff --git a/1164.c b/1164.c new file mode 100644 index 0000000..ded1e90 --- /dev/null +++ b/1164.c @@ -0,0 +1,35 @@ +#include + +int main() { + + int n, x, divisor, soma; + + scanf("%i", &n); + + while(n>0){ + + divisor=1; + soma=0; + + scanf("%i", &x); + + while(x>divisor){ + if(x%divisor==0){ + soma+=divisor; + } + divisor++; + } + + if(soma==x){ + printf("%i eh perfeito\n", x); + } + else{ + printf("%i nao eh perfeito\n", x); + } + + n--; + } + + + return 0; +} diff --git a/1165.c b/1165.c new file mode 100644 index 0000000..87ae73a --- /dev/null +++ b/1165.c @@ -0,0 +1,28 @@ +#include + +int main() { + + int N, x, i=1, j=2, primo; + scanf("%i", &N); + + while(N>=1){ + primo=0; j=2; + + scanf("%i", &x); + + while(x>=j){ + if(x%j==0){ + primo++; + } + j++; + } + if(primo==1){ + printf("%i eh primo\n", x); + } + else{ + printf("%i nao eh primo\n", x); + } + N--; + } + return 0; +} diff --git a/1170.c b/1170.c new file mode 100644 index 0000000..3437395 --- /dev/null +++ b/1170.c @@ -0,0 +1,22 @@ +#include + +int main() +{ + int N, i=1, dias; + float C; + + scanf("%i", &N); + + while(N>=i){ + dias=0; + scanf("%f", &C); + while(C>1){ + C-=C/2; + dias++; + } + printf("%i dias\n", dias); + i++; + } + + return 0; +} diff --git a/1172.c b/1172.c new file mode 100644 index 0000000..2824c07 --- /dev/null +++ b/1172.c @@ -0,0 +1,24 @@ +#include +#define max 10 +int main() +{ + int v[max]; + int i= 0; + + while(i +#define max 10 +int main() +{ + int v[max]; + int i= 0; + + while(i +#define max 100 +int main() +{ + float v[max]; + int i= 0; + + while(i +int main() +{ + + int max= 20; + int v[max]; + int i=0, aux; + + while(i +#define max 100 +int main() +{ + long N, termo, i; + unsigned long long int v[max]; + scanf("%li", &N); + + while(N>0){ + scanf("%li", &termo); + i=2; + + while(max>i){ + v[i]= 0; + + i++; + } + + i=2; + + v[0]= 0; + v[1]= 1; + + if(i>termo){ + printf("Fib(%li) = %llu\n", termo, v[termo]); + } + + while(termo>=i){ + v[i]= v[i-1] + v[i-2]; + + if(i==termo){ + printf("Fib(%li) = %llu\n", i, v[i]); + } + i++; + } + + N--; + } + return 0; +} diff --git a/1177.c b/1177.c new file mode 100644 index 0000000..b57569c --- /dev/null +++ b/1177.c @@ -0,0 +1,24 @@ +#include +#define max 1000 +int main() +{ + int v[max], T, aux, j, cont=0; + + scanf("%i", &T); + + aux= T; + + while(max>cont){ + T= aux; + j= 0; + + while(T>0 && cont<1000){ + v[cont]= j; + printf("N[%i] = %i\n", cont, v[j]); + T--; + j++; + cont++; + } + } + return 0; +} diff --git a/1178.c b/1178.c new file mode 100644 index 0000000..9e6e16a --- /dev/null +++ b/1178.c @@ -0,0 +1,20 @@ +#include +#define max 100 +int main() +{ + + double X, v[max]; + int i=0; + + scanf("%lf", &X); + + + while(max>i){ + v[i]= X; + printf("N[%i] = %.4f\n", i, v[i]); + + X= X/2; + i++; + } + return 0; +} diff --git a/1179V1.c b/1179V1.c new file mode 100644 index 0000000..dec0cf8 --- /dev/null +++ b/1179V1.c @@ -0,0 +1,80 @@ +#include +#define max 5 +int main() +{ + int par[max], impar[max], v[15]; + int i=0, p=0, im=0, j, aux1, aux2; + + while(i<15){ + scanf("%i", &v[i]); + + if(v[i]%2==0){ + par[p]= v[i]; + p++; + + if(p==5){ + p=0; + + while(p<5){ + printf("par[%i] = %i\n", p, par[p]); + p++; + } + + p=0; + + while(p<5){ + par[p]= 0; //verificar como anular + p++; + } + p=0; + } + } + + + else{ + impar[im]= v[i]; + im++; + + if(im==5){ + im=0; + + while(im<5){ + printf("impar[%i] = %i\n", im, impar[im]); + im++; + } + + im=0; + + while(im<5){ + impar[im]= 0; //verificar como anular + im++; + } + im=0; + } + } + + i++; + } + //impressão do que restou abaixo + + j=0; + aux1= im; + + while(aux1>j){ + printf("impar[%i] = %i\n", j, impar[j]); + im++; + j++; + } + + j=0; + aux2= p; + + while(aux2>j){ + printf("par[%i] = %i\n", j, par[j]); + p++; + j++; + } + + + return 0; +} diff --git a/1179V2.c b/1179V2.c new file mode 100644 index 0000000..9a9fd9b --- /dev/null +++ b/1179V2.c @@ -0,0 +1,77 @@ +#include +#define max 5 +int main() +{ + int par[max], impar[max], v[15]; + int i=0, p=0, im=0, j; + + while(i<15){ + scanf("%i", &v[i]); + + if(v[i]%2==0){ //colocar os valores pares + par[p]= v[i]; + p++; + + if(p==max){ + p=0; + + while(pj){ + printf("impar[%i] = %i\n", j, impar[j]); + j++; + } + + j=0; + + while(p>j){ + printf("par[%i] = %i\n", j, par[j]); + j++; + } + + + return 0; +} diff --git a/1180.c b/1180.c new file mode 100644 index 0000000..21562e6 --- /dev/null +++ b/1180.c @@ -0,0 +1,31 @@ +#include + +int main() +{ + int N, i=0, menor, pos; + scanf("%i", &N); + + int v[N]; + + while(N>i){ + scanf("%i", &v[i]); + i++; + } + + i=1; + + menor= v[0]; + + while(N>i){ + if(v[i] +#define max 12 +int main() +{ + float matriz[max][max], soma=0, media; + char T; + int i=0, j=0, a=0, L; + + scanf("%i", &L); + scanf(" %c", &T); + + while(a +#define max 12 +int main() +{ + float matriz[max][max], soma=0, media; + char T; + int i=0, j=0, a=0, C; + + scanf("%i", &C); + scanf(" %c", &T); + + while(a +#define max 12 +int main() { + + char O; + float M[max][max], soma=0; + int i=0, j=0, aux; + + + scanf(" %c", &O); + + while(i +#define max 12 +int main() { + + char O; + float M[max][max], soma=0; + int i=0, j=0, aux; + + + scanf(" %c", &O); + + while(i +#define max 12 +int main() { + + char O; + float M[max][max], soma=0; + int i=0, j=0, aux; + + + scanf(" %c", &O); + + while(i +#define max 12 +int main() { + + char O; + float M[max][max], soma=0; + int i=0, j=0, aux; + + + scanf(" %c", &O); + + while(i +#define max 12 +int main() { + + char O; + float M[max][max], soma=0; + int i=0, j=0, aux; + + + scanf(" %c", &O); + + while(i +#define tam 12 + +int main() { + + char C; + + scanf("%c", &C); + + int total = tam, denominador = 0; + double Media = 0, M[tam][tam], Soma = 0; + + for(int i = 0; i < tam; i++){ + for(int j = 0; j < tam; j++){ + scanf("%lf", &M[i][j]); + } + } + + for(int i = 0; i < tam/2 - 1; i++){ + for(int j = i + 1; j < total - 1; j++){ + Soma += M[i][j]; + denominador++; + } + total--; + } + + Media = Soma/denominador; + + C == 'S'? printf("%.1lf\n", Soma) : printf("%.1lf\n", Media); + + + return 0; +} diff --git a/1188.c b/1188.c new file mode 100644 index 0000000..8cda885 --- /dev/null +++ b/1188.c @@ -0,0 +1,36 @@ +#include +#define tam 12 + +int main() { + + char C; + int a; + + scanf("%c", &C); + + int total = tam, denominador = 0; + double Media = 0, M[tam][tam], Soma = 0; + + for(int i = 0; i < tam; i++){ + for(int j = 0; j < tam; j++){ + scanf("%lf", &M[i][j]); + } + } + + a = 1; + for(int i = tam - 1; i > tam/2; i--){ + for(int j = a; j < total - 1; j++){ + Soma += M[i][j]; + denominador++; + } + a++; + total--; + } + + Media = Soma/denominador; + + C == 'S'? printf("%.1lf\n", Soma) : printf("%.1lf\n", Media); + + + return 0; +} diff --git a/1189.c b/1189.c new file mode 100644 index 0000000..11ce920 --- /dev/null +++ b/1189.c @@ -0,0 +1,42 @@ +#include +#define tam 12 + +int main() { + + char C; + + scanf("%c", &C); + + int denominador = 0, aux; + double Media = 0, M[tam][tam], Soma = 0; + + for(int i = 0; i < tam; i++){ + for(int j = 0; j < tam; j++){ + scanf("%lf", &M[i][j]); + } + } + + aux = 5; + for(int i = 1; i < tam - 1; i++){ + if(i <= 5){ + for(int j = 0; j < i; j++){ + Soma += M[i][j]; + denominador++; + } + } + else{ + for(int j = 0; j < aux; j++){ + Soma += M[i][j]; + denominador++; + } + aux--; + } + } + + Media = Soma/denominador; + + C == 'S'? printf("%.1lf\n", Soma) : printf("%.1lf\n", Media); + + + return 0; +} diff --git a/1190.c b/1190.c new file mode 100644 index 0000000..e6996df --- /dev/null +++ b/1190.c @@ -0,0 +1,43 @@ +#include +#define tam 12 + +int main() { + + char C; + + scanf("%c", &C); + + int denominador = 0, aux, total = tam; + double Media = 0, M[tam][tam], Soma = 0; + + for(int i = 0; i < tam; i++){ + for(int j = 0; j < tam; j++){ + scanf("%lf", &M[i][j]); + } + } + + aux = tam/2 + 1; + for(int i = 1; i < tam - 1; i++){ + if(i <= 5){ + for(int j = tam - 1; j >= total - 1; j--){ + Soma += M[i][j]; + denominador++; + } + total--; + } + else{ + for(int j = aux; j < tam; j++){ + Soma += M[i][j]; + denominador++; + } + aux++; + } + } + + Media = Soma/denominador; + + C == 'S'? printf("%.1lf\n", Soma) : printf("%.1lf\n", Media); + + + return 0; +} diff --git a/1221.c b/1221.c new file mode 100644 index 0000000..ddfc61d --- /dev/null +++ b/1221.c @@ -0,0 +1,33 @@ +#include +#include + +int main() { + +long N=2, x, primo, j, quadrada; + +scanf("%li", &N); + +while(N>=1){ + primo=0, j=2; + + scanf("%li", &x); + + quadrada= sqrt(x); + + while(quadrada>=j){ + if(x%j==0){ + primo++; + } + j++; + } + if(primo==0){ + printf("Prime\n"); + } + else{ + printf("Not Prime\n"); + } + N--; +} + + return 0; +} diff --git a/1237.c b/1237.c new file mode 100644 index 0000000..947948f --- /dev/null +++ b/1237.c @@ -0,0 +1,58 @@ +#include +#include + +int main() { + + char string1[51], string2[51]; + + while(gets(string1) && gets(string2)){ + + int coincide = 0; + int maior = coincide; + + for(int i = 0; i < strlen(string1); i++){ + for(int j = 0; j < strlen(string2); j++){ + int jCOPY = j; + int iCOPY = i; + if(string1[i] == string2[j]){ + while(string1[iCOPY] == string2[jCOPY] && string2[jCOPY] != '\0' && string1[iCOPY] != '\0'){ + coincide++; + jCOPY++; + iCOPY++; + } + } + + if(coincide > maior){ + maior = coincide; + } + coincide = 0; + } + } + int coincide2 = 0; + int maior2 = coincide2; + + for(int i = 0; i < strlen(string2); i++){ + + for(int j = 0; j < strlen(string1); j++){ + int jCOPY = j; + int iCOPY = i; + if(string1[j] == string2[i]){ + while(string1[jCOPY] == string2[iCOPY] && string1[jCOPY] != '\0' && string2[iCOPY] != '\0'){ + coincide2++; + jCOPY++; + iCOPY++; + } + } + + if(coincide2 > maior2){ + maior2 = coincide2; + } + coincide2 = 0; + } + } + + (maior > maior2)? printf("%i\n", maior) : printf("%i\n", maior2); + } + + return 0; +} diff --git a/1323.c b/1323.c new file mode 100644 index 0000000..68bfdd5 --- /dev/null +++ b/1323.c @@ -0,0 +1,21 @@ +#include + +int main() { + + int n, i=1, quant=0; + + do{ + scanf("%i", &n); + while(n>=i){ + quant+=i*i; + i++; + } + if(n!=0){ + printf("%i\n", quant); + } + quant=0; + i=1; + }while(n!=0); + + return 0; +} diff --git a/1541.c b/1541.c new file mode 100644 index 0000000..a1d5969 --- /dev/null +++ b/1541.c @@ -0,0 +1,25 @@ +#include +#include + +int main() { + + int A = 1, B = 1, porcentagem; + float porcentagem2, ladoReal; + + + do{ + scanf("%i %i %i", &A, &B, &porcentagem); + + if(A == 0 || B == 0) + break; + + porcentagem2 = porcentagem/100.0; + + ladoReal = sqrt((A * B)/ porcentagem2); + + printf("%i\n", (int)ladoReal); + + }while(A != 0 && B != 0); + + return 0; +} diff --git a/1564.c b/1564.c new file mode 100644 index 0000000..f0842e3 --- /dev/null +++ b/1564.c @@ -0,0 +1,19 @@ +#include + +int main() { + + int i=3; + + while(scanf("%i", &i) != EOF){ + + if(i==0){ + printf("vai ter copa!\n"); + } + else{ + printf("vai ter duas!\n"); + } + + } + + return 0; +} diff --git a/1589.c b/1589.c new file mode 100644 index 0000000..4d85b32 --- /dev/null +++ b/1589.c @@ -0,0 +1,15 @@ +#include + +int main() { + int T, R1, R2, i=1, soma; + scanf("%i", &T); + + while(T>=i){ + scanf("%i %i", &R1, &R2); + soma= R1+R2; + printf("%i\n", soma); + i++; + } + + return 0; +} diff --git a/1759.c b/1759.c new file mode 100644 index 0000000..4846553 --- /dev/null +++ b/1759.c @@ -0,0 +1,17 @@ +#include + +int main() { + + long N; + + scanf("%li", &N); + + while(N>1){ + printf("Ho "); + + N--; + } + + printf("Ho!\n"); + return 0; +} diff --git a/1789.c b/1789.c new file mode 100644 index 0000000..12709df --- /dev/null +++ b/1789.c @@ -0,0 +1,40 @@ +#include + +int main() { + + int L, V, i=0, maior; + + + while(scanf("%i", &L)!=EOF){ + + int grupo[L]; + + maior= 0; + + while(imaior){ + maior= grupo[i]; + } + + i++; + } + + i=0; + + if(maior<10){ + printf("1\n"); + } + else if(maior>=10 && maior<20){ + printf("2\n"); + } + else{ + printf("3\n"); + } + } + + + return 0; +} diff --git a/1828.c b/1828.c new file mode 100644 index 0000000..a9f2ac0 --- /dev/null +++ b/1828.c @@ -0,0 +1,89 @@ +#include +#include + +int main() { + int T, i = 1; + char jogada[20], jogada1[10], jogada2[10]; + char *token; + + scanf("%i", &T); + getchar(); + + while(i <= T){ + fgets(jogada, 20, stdin); + + + token = strtok(jogada, " "); + + int j = 0; + + while(token != NULL){ + if(j == 0) + strcpy(jogada1, token); + else + strcpy(jogada2, token); + + j++; + + token = strtok(NULL, " "); + } + + for(int w = 0; w < 10; w++){ //para tirar o '\n' que está indo ao final da 2ª string + if(jogada2[w] == '\n'){ + jogada2[w] = '\0'; + break; + } + } + + + if(strcmp(jogada1, jogada2) == 0) + printf("Caso #%i: De novo!\n", i); + + else{ + if(strcmp(jogada1, "tesoura") == 0){ //tesoura + if(strcmp(jogada2, "papel") == 0 || strcmp(jogada2, "lagarto") == 0){ + printf("Caso #%i: Bazinga!\n", i); + } + else + printf("Caso #%i: Raj trapaceou!\n", i); + } + + else if(strcmp(jogada1, "papel") == 0){ //papel + if(strcmp(jogada2, "pedra") == 0 || strcmp(jogada2, "Spock") == 0){ + printf("Caso #%i: Bazinga!\n", i); + } + else + printf("Caso #%i: Raj trapaceou!\n", i); + } + + else if(strcmp(jogada1, "pedra") == 0){ //pedra + if(strcmp(jogada2, "lagarto") == 0 || strcmp(jogada2, "tesoura") == 0){ + printf("Caso #%i: Bazinga!\n", i); + } + else + printf("Caso #%i: Raj trapaceou!\n", i); + } + + else if(strcmp(jogada1, "lagarto") == 0){ //lagarto + if(strcmp(jogada2, "Spock") == 0 || strcmp(jogada2, "papel") == 0){ + printf("Caso #%i: Bazinga!\n", i); + } + else + printf("Caso #%i: Raj trapaceou!\n", i); + } + + else if(strcmp(jogada1, "Spock") == 0){ //Spock + if(strcmp(jogada2, "tesoura") == 0 || strcmp(jogada2, "pedra") == 0){ + printf("Caso #%i: Bazinga!\n", i); + } + else + printf("Caso #%i: Raj trapaceou!\n", i); + } + + } + + i++; + } + + return 0; +} diff --git a/1837.c b/1837.c new file mode 100644 index 0000000..8b02819 --- /dev/null +++ b/1837.c @@ -0,0 +1,29 @@ +#include +#include + +int main() { + + int a, b, resto = 0, quociente = 0; + + scanf("%i %i", &a, &b); + + quociente = a/b; + + resto = a - quociente * b; + + if(resto >= 0) + printf("%i %i\n", quociente, resto); + else{ + if(b < 0) + quociente = a/b + 1; + else + quociente = a/b - 1; + + resto = ((quociente * b) - a) * -1; + + printf("%i %i\n", quociente, resto); + } + + + return 0; +} diff --git a/1847.c b/1847.c new file mode 100644 index 0000000..b9e11de --- /dev/null +++ b/1847.c @@ -0,0 +1,29 @@ +#include + +int main() { + + int a, b, c; + + scanf("%i %i %i", &a, &b, &c); + + if(a > b){ + if(b > c && (b - c) >= (a - b)) + printf(":(\n"); + else + printf(":)\n"); + } + else if(a < b){ + if(b < c && (c - b) >= (b - a)) + printf(":)\n"); + else + printf(":(\n"); + } + else{ + if(b < c) + printf(":)\n"); + else + printf(":(\n"); + } + + return 0; +} diff --git a/1848.c b/1848.c new file mode 100644 index 0000000..0f4972d --- /dev/null +++ b/1848.c @@ -0,0 +1,32 @@ +#include +#include + +int main() +{ + char olhoCorvo[8]; + int loteria = 0, grito; + + for(grito = 1; grito <= 3;){ + + fgets(olhoCorvo, 8, stdin); + + if(strcmp(olhoCorvo, "caw caw") == 0){ + printf("%i\n", loteria); + grito++; + loteria = 0; + } + + else{ + if(olhoCorvo[0] == '*') + loteria += 4; + + if(olhoCorvo[1] == '*') + loteria += 2; + + if(olhoCorvo[2] == '*') + loteria += 1; + } + } + + return 0; +} diff --git a/1858.c b/1858.c new file mode 100644 index 0000000..8c73e66 --- /dev/null +++ b/1858.c @@ -0,0 +1,24 @@ +#include + +int main() { + int N; + scanf("%i", &N); + int vetor[N],i = 0; + + while(i < N){ + scanf("%i", &vetor[i]); + i++; + } + + int menor = vetor[0], posicao = 1; + + for(int i = 1; i < N; i++){ + if(vetor[i] < menor){ + menor = vetor[i]; + posicao = i + 1; + } + } + + printf("%i\n", posicao); + return 0; +} diff --git a/1864.c b/1864.c new file mode 100644 index 0000000..574c6ec --- /dev/null +++ b/1864.c @@ -0,0 +1,16 @@ +#include + +int main() { + + char string[35] = "LIFE IS NOT A PROBLEM TO BE SOLVED"; + + int N; + scanf("%i", &N); + + for(int i = 0; i < N; i++){ + printf("%c", string[i]); + } + printf("\n"); + + return 0; +} diff --git a/1865.c b/1865.c new file mode 100644 index 0000000..b0b1694 --- /dev/null +++ b/1865.c @@ -0,0 +1,26 @@ +#include +#include + +int main() { + + int C, inteiro; + char string[40]; + scanf("%i", &C); + getchar(); + + + while(C > 0){ + fgets(string, 40, stdin); + + char *tok = strtok(string, " "); + + if(strcmp("Thor", tok) == 0) + printf("Y\n"); + else + printf("N\n"); + + C--; + } + + return 0; +} diff --git a/1866.c b/1866.c new file mode 100644 index 0000000..5058105 --- /dev/null +++ b/1866.c @@ -0,0 +1,13 @@ +#include + +int main() { + int N, num; + scanf("%i", &N); + + while(N > 0){ + scanf("%i", &num); + (num % 2 == 0)?printf("0\n"):printf("1\n"); + N--; + } + return 0; +} diff --git a/1914.c b/1914.c new file mode 100644 index 0000000..6a8325a --- /dev/null +++ b/1914.c @@ -0,0 +1,36 @@ +#include +#include + +int main() { + int Q, a, b, soma = 0; + + scanf("%i", &Q); + + while(Q > 0){ + + char string[30]; + char stringSeparada[4][30]; + getchar(); + fgets(string, 30, stdin); + sscanf(string, "%s %s %s %s", stringSeparada[0], stringSeparada[1], stringSeparada[2], stringSeparada[3]); + + scanf("%i %i", &a, &b); + + soma = a + b; + + if(soma % 2 == 0){ + if(strcmp(stringSeparada[1], "PAR") == 0) + puts(stringSeparada[0]); + else + puts(stringSeparada[2]); + } + else{ + if(strcmp(stringSeparada[1], "IMPAR") == 0) + puts(stringSeparada[0]); + else + puts(stringSeparada[2]); + } + Q--; + } + return 0; +} diff --git a/1924.c b/1924.c new file mode 100644 index 0000000..49f0022 --- /dev/null +++ b/1924.c @@ -0,0 +1,19 @@ +#include + +int main() { + + int n; + scanf("%i", &n); + + while(n > 0){ + char string[103]; + + fgets(string, 103, stdin); + + n--; + } + + printf("Ciencia da Computacao\n"); + + return 0; +} diff --git a/1930.c b/1930.c new file mode 100644 index 0000000..e63e1a6 --- /dev/null +++ b/1930.c @@ -0,0 +1,11 @@ +#include + +int main() { + int T1, T2, T3, T4; + + scanf("%i %i %i %i", &T1, &T2, &T3, &T4); + + printf("%i\n", (T1 + T2 + T3 + T4) - 3); + + return 0; +} diff --git a/1963.c b/1963.c new file mode 100644 index 0000000..099a8ce --- /dev/null +++ b/1963.c @@ -0,0 +1,13 @@ +#include + +int main() { + + float a, b, percent; + + scanf("%f %f", &a, &b); + + percent = ((b - a) * 100)/a; + + printf("%.2f%\n", percent); + return 0; +} diff --git a/1985.c b/1985.c new file mode 100644 index 0000000..77e0cc6 --- /dev/null +++ b/1985.c @@ -0,0 +1,27 @@ +#include + +int main() +{ + int n, p, quant; + float soma=0; + + scanf("%i", &n); + + while(n>0){ + scanf("%i", &p); + scanf("%i", &quant); + + switch(p){ + case 1001: soma+= quant * 1.50; break; + case 1002: soma+= quant * 2.50; break; + case 1003: soma+= quant * 3.50; break; + case 1004: soma+= quant * 4.50; break; + case 1005: soma+= quant * 5.50; + } + + n--; + } + + printf("%.2f\n", soma); + return 0; +} diff --git a/2006.c b/2006.c new file mode 100644 index 0000000..b39ed08 --- /dev/null +++ b/2006.c @@ -0,0 +1,19 @@ +#include + +int main() { + + int T, acertos=0; + int A, B, C, D, E; + + scanf("%i", &T); + scanf("%i %i %i %i %i", &A, &B, &C, &D, &E); + + if(A==T){acertos++;} + if(B==T){acertos++;} + if(C==T){acertos++;} + if(D==T){acertos++;} + if(E==T){acertos++;} + + printf("%i\n", acertos); + return 0; +} diff --git a/2057.c b/2057.c new file mode 100644 index 0000000..5f61cc7 --- /dev/null +++ b/2057.c @@ -0,0 +1,30 @@ +#include +#include +#include + +int main() { + + char string[20]; + int vetor[3], resultado; + + fgets(string, 20, stdin); + + char *tok = strtok(string, " "); + + for(int i = 0; i < 3; i++){ + vetor[i] = atoi(tok); + tok = strtok(NULL, " "); + } + + resultado = vetor[0] + vetor[1] + vetor[2]; + + if(resultado > 24) + resultado -= 24; + else if(resultado < 0) + resultado += 24; + + printf("%i\n", resultado); + + + return 0; +} diff --git a/2060.c b/2060.c new file mode 100644 index 0000000..929f4d1 --- /dev/null +++ b/2060.c @@ -0,0 +1,29 @@ +#include +#include + +int main() { + + int N, m4 = 0, m3 = 0, m2 = 0, m5 = 0; + scanf("%i", &N); + + int *V = malloc(sizeof(int)*N); + + for(int i = 0; i < N; i++){ + scanf("%i", &V[i]); + } + + for(int i = 0; i < N; i++){ + if(V[i]%2 == 0) + m2++; + if(V[i]%3 == 0) + m3++; + if(V[i]%4 == 0) + m4++; + if(V[i]%5 == 0) + m5++; + } + + printf("%i Multiplo(s) de 2\n%i Multiplo(s) de 3\n%i Multiplo(s) de 4\n%i Multiplo(s) de 5\n", m2, m3, m4, m5); + + return 0; +} diff --git a/2146.c b/2146.c new file mode 100644 index 0000000..9cc0cf8 --- /dev/null +++ b/2146.c @@ -0,0 +1,11 @@ +#include + +int main() { + int N; + + while(scanf("%i", &N) != EOF){ + printf("%i\n", N - 1); + } + + return 0; +} diff --git a/2164.c b/2164.c new file mode 100644 index 0000000..f226e98 --- /dev/null +++ b/2164.c @@ -0,0 +1,15 @@ +#include +#include +#include + +int main() { + int N; + double fibonacci; + + scanf("%i", &N); + + fibonacci = (pow((1 + sqrt(5))/2, N) - pow((1 - sqrt(5))/2, N))/sqrt(5); + + printf("%.1lf\n", fibonacci); + return 0; +} diff --git a/2165.c b/2165.c new file mode 100644 index 0000000..5c8ee29 --- /dev/null +++ b/2165.c @@ -0,0 +1,12 @@ +#include +#include + +int main() { + char texto[502]; + + fgets(texto, 502, stdin); + + ((strlen(texto) - 1) <= 140)? printf("TWEET\n") : printf("MUTE\n"); + + return 0; +} diff --git a/2542.c b/2542.c new file mode 100644 index 0000000..d8552a1 --- /dev/null +++ b/2542.c @@ -0,0 +1,61 @@ +#include + +int main() { + +int N, M, L, CM, A, CL, i=1, j=1; + +while(scanf("%i", &N) != EOF){ + scanf("%i %i", &M, &L); + + M= M+1; + L= L+1; + N= N+1; + + int Ma[M][N]; + int Le[L][N]; + + while(iLe[CL][A]){ + printf("Marcos\n"); + } + + else if(Ma[CM][A] + +int main() { + + int N; + scanf("%i", &N); + + while(N > 0){ + printf("I am Toorg!\n"); + N--; + } + + return 0; +} diff --git a/2582.c b/2582.c new file mode 100644 index 0000000..0a48eda --- /dev/null +++ b/2582.c @@ -0,0 +1,55 @@ +#include + +int main() { + + int C, X, Y; + int soma = 0; + + scanf("%i", &C); + + while(C > 0){ + scanf("%i %i", &X, &Y); + + soma = X + Y; + + switch(soma){ + case 0: + printf("PROXYCITY\n"); + break; + case 1: + printf("P.Y.N.G.\n"); + break; + case 2: + printf("DNSUEY!\n"); + break; + case 3: + printf("SERVERS\n"); + break; + case 4: + printf("HOST!\n"); + break; + case 5: + printf("CRIPTONIZE\n"); + break; + case 6: + printf("OFFLINE DAY\n"); + break; + case 7: + printf("SALT\n"); + break; + case 8: + printf("ANSWER!\n"); + break; + case 9: + printf("RAR?\n"); + break; + case 10: + printf("WIFI ANTENNAS\n"); + break; + } + + C--; + } + + return 0; +} diff --git a/2709.c b/2709.c new file mode 100644 index 0000000..8dbed41 --- /dev/null +++ b/2709.c @@ -0,0 +1,45 @@ +#include +#include + +int main() { + int M; + + while(scanf("%i", &M) != EOF){ + + int *V = malloc(sizeof(int) * M); + + int soma = 0, ehPrimo = 0, N = 0, i = 0; + + while(i < M){ + scanf("%i", &V[i]); + i++; + } + + scanf("%i", &N); + M -= 1; + + while(M >= 0){ + soma += V[M]; + M -= N; + } + + int somaAux = soma; + + while(somaAux > 0){ + if(soma % somaAux == 0){ + ehPrimo++; + } + somaAux--; + } + + free(V); + + if(ehPrimo == 2) + printf("You’re a coastal aircraft, Robbie, a large silver aircraft.\n"); + else + printf("Bad boy! I’ll hit you.\n"); + + } + + return 0; +} diff --git a/2747.c b/2747.c new file mode 100644 index 0000000..831569f --- /dev/null +++ b/2747.c @@ -0,0 +1,30 @@ +#include + +void trintaNove(); + +int main() +{ + trintaNove(); + + for(int j = 1; j <= 5; j++){ + for(int i = 1; i <= 39; i++){ + if(i == 1) + printf("|"); + else if(i == 39) + printf("|\n"); + else + printf(" "); + } + } + + trintaNove(); + + return 0; +} + +void trintaNove(){ + for(int N = 1; N <= 39; N++){ + printf("-"); + } + printf("\n"); +} diff --git a/2753.c b/2753.c new file mode 100644 index 0000000..7b75762 --- /dev/null +++ b/2753.c @@ -0,0 +1,10 @@ +#include + +int main() { + + for(int i = 'a', valor = 97; i <= 'z'; i++, valor++){ + printf("%i e %c\n", valor, i); + } + + return 0; +} diff --git a/2780.c b/2780.c new file mode 100644 index 0000000..362d68d --- /dev/null +++ b/2780.c @@ -0,0 +1,16 @@ +#include + +int main() { + + int d; + scanf("%i", &d); + + if(d <= 800) + printf("1\n"); + else if(d <= 1400) + printf("2\n"); + else + printf("3\n"); + + return 0; +} diff --git a/2791.c b/2791.c new file mode 100644 index 0000000..f87c07b --- /dev/null +++ b/2791.c @@ -0,0 +1,18 @@ +#include + +int main() { + int C1, C2, C3, C4; + + scanf("%i %i %i %i", &C1, &C2, &C3, &C4); + + if(C1 == 1) + printf("1\n"); + else if(C2 == 1) + printf("2\n"); + else if(C3 == 1) + printf("3\n"); + else + printf("4\n"); + + return 0; +} diff --git a/2861.c b/2861.c new file mode 100644 index 0000000..71c2ed3 --- /dev/null +++ b/2861.c @@ -0,0 +1,20 @@ +#include +#include + +int main() { + int C; + char string[200]; + + scanf("%i", &C); + + while(C >= 0){ + fgets(string, 200, stdin); + + if(strchr(string, '?')) + printf("gzuz\n"); + + C--; + } + + return 0; +} diff --git a/2867.c b/2867.c new file mode 100644 index 0000000..cf15c30 --- /dev/null +++ b/2867.c @@ -0,0 +1,26 @@ +#include +#include + +int main() +{ + int N, num, potencia, digitos = 1, resultado; + + scanf("%i", &N); + + while(N > 0){ + digitos = 1; + + scanf("%i %i", &num, &potencia); + + resultado = (int)floor(log10(pow(num, potencia))); + + digitos += resultado; + + printf("%i\n", digitos); + + N--; + } + + return 0; +} + diff --git a/3076.c b/3076.c new file mode 100644 index 0000000..1c3bce3 --- /dev/null +++ b/3076.c @@ -0,0 +1,18 @@ +#include + +int main() { + + long long int N; + + while(scanf("%lli", &N) != EOF){ + int seculo = N/100; + + while(N > seculo * 100){ + seculo += 1; + } + printf("%i\n", seculo); + } + + return 0; +} + diff --git a/3209.c b/3209.c new file mode 100644 index 0000000..e4e2b27 --- /dev/null +++ b/3209.c @@ -0,0 +1,27 @@ +#include + +int main() { + + int N, tomadas, entradas; + scanf("%i", &N); + + while(N > 0){ + int soma = 1; + + scanf("%i", &tomadas); + int aux = tomadas; + + while(aux > 0){ + scanf("%i", &entradas); + soma += entradas; + aux--; + } + + soma -= tomadas; + printf("%i\n", soma); + + N--; + } + + return 0; +}