From 121b7edc884650c83da4e9329d1e872e95596a88 Mon Sep 17 00:00:00 2001 From: Caio Lima Date: Thu, 13 Jun 2024 15:05:14 -0300 Subject: [PATCH] =?UTF-8?q?adicionando=20resolu=C3=A7=C3=B5es=20em=20C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 1. Iniciante/1000.c | 8 +++ 1. Iniciante/1002.c | 12 +++++ 1. Iniciante/1007.c | 9 ++++ 1. Iniciante/1008.c | 11 ++++ 1. Iniciante/1010.c | 11 ++++ 1. Iniciante/1011.c | 10 ++++ 1. Iniciante/1013.c | 11 ++++ 1. Iniciante/1014.c | 10 ++++ 1. Iniciante/1021.c | 117 ++++++++++++++++++++++++++++++++++++++++ 1. Iniciante/1035.c | 12 +++++ 1. Iniciante/1037.c | 29 ++++++++++ 1. Iniciante/1038.c | 21 ++++++++ 1. Iniciante/1043.c | 18 +++++++ 1. Iniciante/1044.c | 13 +++++ 1. Iniciante/1048.c | 34 ++++++++++++ 1. Iniciante/1050.c | 27 ++++++++++ 1. Iniciante/1052.c | 44 +++++++++++++++ 1. Iniciante/1059.c | 9 ++++ 1. Iniciante/1060.c | 14 +++++ 1. Iniciante/1061.c | 29 ++++++++++ 1. Iniciante/1064.c | 17 ++++++ 1. Iniciante/1065.c | 13 +++++ 1. Iniciante/1070.c | 14 +++++ 1. Iniciante/1072.c | 18 +++++++ 1. Iniciante/1073.c | 12 +++++ 1. Iniciante/1080.c | 15 ++++++ 1. Iniciante/1094.c | 34 ++++++++++++ 1. Iniciante/1095.c | 10 ++++ 1. Iniciante/1096.c | 11 ++++ 1. Iniciante/1098.c | 36 +++++++++++++ 1. Iniciante/1101.c | 21 ++++++++ 1. Iniciante/1113.c | 16 ++++++ 1. Iniciante/1172.c | 18 +++++++ 1. Iniciante/1173.c | 13 +++++ 1. Iniciante/1174.c | 15 ++++++ 1. Iniciante/1175.c | 14 +++++ 1. Iniciante/1180.c | 20 +++++++ 1. Iniciante/1182.c | 29 ++++++++++ 1. Iniciante/1184.c | 32 +++++++++++ 1. Iniciante/gerador.py | 25 +++++++++ 40 files changed, 832 insertions(+) create mode 100644 1. Iniciante/1000.c create mode 100644 1. Iniciante/1002.c create mode 100644 1. Iniciante/1007.c create mode 100644 1. Iniciante/1008.c create mode 100644 1. Iniciante/1010.c create mode 100644 1. Iniciante/1011.c create mode 100644 1. Iniciante/1013.c create mode 100644 1. Iniciante/1014.c create mode 100644 1. Iniciante/1021.c create mode 100644 1. Iniciante/1035.c create mode 100644 1. Iniciante/1037.c create mode 100644 1. Iniciante/1038.c create mode 100644 1. Iniciante/1043.c create mode 100644 1. Iniciante/1044.c create mode 100644 1. Iniciante/1048.c create mode 100644 1. Iniciante/1050.c create mode 100644 1. Iniciante/1052.c create mode 100644 1. Iniciante/1059.c create mode 100644 1. Iniciante/1060.c create mode 100644 1. Iniciante/1061.c create mode 100644 1. Iniciante/1064.c create mode 100644 1. Iniciante/1065.c create mode 100644 1. Iniciante/1070.c create mode 100644 1. Iniciante/1072.c create mode 100644 1. Iniciante/1073.c create mode 100644 1. Iniciante/1080.c create mode 100644 1. Iniciante/1094.c create mode 100644 1. Iniciante/1095.c create mode 100644 1. Iniciante/1096.c create mode 100644 1. Iniciante/1098.c create mode 100644 1. Iniciante/1101.c create mode 100644 1. Iniciante/1113.c create mode 100644 1. Iniciante/1172.c create mode 100644 1. Iniciante/1173.c create mode 100644 1. Iniciante/1174.c create mode 100644 1. Iniciante/1175.c create mode 100644 1. Iniciante/1180.c create mode 100644 1. Iniciante/1182.c create mode 100644 1. Iniciante/1184.c create mode 100644 1. Iniciante/gerador.py diff --git a/1. Iniciante/1000.c b/1. Iniciante/1000.c new file mode 100644 index 0000000..84cb1a5 --- /dev/null +++ b/1. Iniciante/1000.c @@ -0,0 +1,8 @@ +#include + +int main() { + + printf("Hello World!\n"); + + return 0; +} \ No newline at end of file diff --git a/1. Iniciante/1002.c b/1. Iniciante/1002.c new file mode 100644 index 0000000..54eb2ae --- /dev/null +++ b/1. Iniciante/1002.c @@ -0,0 +1,12 @@ +#include +#include + +int main(){ + + double raio, area; + scanf("%lf", &raio); + area = 3.14159 * pow(raio,2); + printf("A=%.4lf\n", area); + return 0; + +} diff --git a/1. Iniciante/1007.c b/1. Iniciante/1007.c new file mode 100644 index 0000000..2280797 --- /dev/null +++ b/1. Iniciante/1007.c @@ -0,0 +1,9 @@ +#include + +int main(){ + int A = 0, B = 0, C = 0, D = 0, DIFERENCA = 0; + scanf("%d %d %d %d", &A, &B, &C, &D); + DIFERENCA = (A * B - C * D); + printf("DIFERENCA = %d\n", DIFERENCA); + return 0; +} \ No newline at end of file diff --git a/1. Iniciante/1008.c b/1. Iniciante/1008.c new file mode 100644 index 0000000..5c2e6ae --- /dev/null +++ b/1. Iniciante/1008.c @@ -0,0 +1,11 @@ +#include + +int main(){ + int num, hora = 0; + double valor, salario = 0; + scanf("%d %d %lf", &num, &hora, &valor); + salario = valor * hora; + printf("NUMBER = %d\n", num); + printf("SALARY = U$ %.2lf\n", salario); + return 0; +} diff --git a/1. Iniciante/1010.c b/1. Iniciante/1010.c new file mode 100644 index 0000000..f1494bf --- /dev/null +++ b/1. Iniciante/1010.c @@ -0,0 +1,11 @@ +#include + +int main(){ + int np1, np2, qnt1, qnt2 = 0; + double vu1, vu2, vt = 0; + scanf("%d %d %lf", &np1, &qnt1, &vu1); + scanf("%d %d %lf", &np2, &qnt2, &vu2); + vt = (qnt1 * vu1) + (qnt2 * vu2); + printf("VALOR A PAGAR: R$ %.2lf\n", vt); + return 0; +} diff --git a/1. Iniciante/1011.c b/1. Iniciante/1011.c new file mode 100644 index 0000000..4df57f6 --- /dev/null +++ b/1. Iniciante/1011.c @@ -0,0 +1,10 @@ +#include +#include + +int main(){ + double v = 0, r = 0; + scanf("%lf", &r); + v = (4.0/3) * 3.14159 * pow(r, 3); + printf("VOLUME = %.3lf\n", v); + return 0; +} \ No newline at end of file diff --git a/1. Iniciante/1013.c b/1. Iniciante/1013.c new file mode 100644 index 0000000..82e98e8 --- /dev/null +++ b/1. Iniciante/1013.c @@ -0,0 +1,11 @@ +#include +#include + +int main(){ + int A, B, C, MaiorAB; + scanf("%d %d %d", &A, &B, &C); + MaiorAB =(A+B+abs(A-B))/2; + MaiorAB=(C+MaiorAB+abs(MaiorAB-C))/2; + printf("%d eh o maior\n",MaiorAB); + return 0; +} diff --git a/1. Iniciante/1014.c b/1. Iniciante/1014.c new file mode 100644 index 0000000..39e28ae --- /dev/null +++ b/1. Iniciante/1014.c @@ -0,0 +1,10 @@ +#include + +int main(){ + int dist = 0; + double comb = 0, media = 0; + scanf("%d %lf", &dist, &comb); + media = dist / comb; + printf("%.3lf km/l\n", media); + return 0; +} diff --git a/1. Iniciante/1021.c b/1. Iniciante/1021.c new file mode 100644 index 0000000..9c7cda3 --- /dev/null +++ b/1. Iniciante/1021.c @@ -0,0 +1,117 @@ +#include + +int main() + +{ + + + +double valor,D,E; + + + + +int nota,b,d,f,h,j,B,m,o,q,s; + +int cem,cinquenta,vinte,dez,cinco,dois; + +int m_um,m_cinquenta,m_vintecinco,m_dez,m_cinco,m_umcent; + + + + + + + +scanf ("%lf",&valor); + + + +nota=valor; + +cem=nota/100; + +b=nota%100; + +cinquenta=b/50; + +d=b%50; + +vinte=d/20; + +f=d%20; + +dez=f/10; + +h=f%10; + +cinco=h/5; + +j=h%5; + +dois=j/2; + +m_um=j%2; + + + + +E=valor*100; + +B=(int) E; + +m=B%100; + +m_cinquenta=m/50; + +o=m%50; + +m_vintecinco=o/25; + +q=o%25; + +m_dez=q/10; + +s=q%10; + +m_cinco=s/5; + +m_umcent=s%5; + + + + +printf ("NOTAS:\n"); + +printf ("%d nota(s) de R$ 100.00\n",cem); + +printf ("%d nota(s) de R$ 50.00\n",cinquenta); + +printf ("%d nota(s) de R$ 20.00\n",vinte); + +printf ("%d nota(s) de R$ 10.00\n",dez); + +printf ("%d nota(s) de R$ 5.00\n",cinco); + +printf ("%d nota(s) de R$ 2.00\n",dois); + +printf ("MOEDAS:\n"); + +printf ("%d moeda(s) de R$ 1.00\n",m_um); + +printf ("%d moeda(s) de R$ 0.50\n",m_cinquenta); + +printf ("%d moeda(s) de R$ 0.25\n",m_vintecinco); + +printf ("%d moeda(s) de R$ 0.10\n",m_dez); + +printf ("%d moeda(s) de R$ 0.05\n",m_cinco); + +printf ("%d moeda(s) de R$ 0.01\n",m_umcent); + + + + +return 0; + +} \ No newline at end of file diff --git a/1. Iniciante/1035.c b/1. Iniciante/1035.c new file mode 100644 index 0000000..0e086eb --- /dev/null +++ b/1. Iniciante/1035.c @@ -0,0 +1,12 @@ +#include +int 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 > 0 && D > 0 && A % 2 == 0){ + printf("Valores aceitos\n"); + } + else { + printf("Valores nao aceitos\n"); + } + return 0; +} diff --git a/1. Iniciante/1037.c b/1. Iniciante/1037.c new file mode 100644 index 0000000..e65d46d --- /dev/null +++ b/1. Iniciante/1037.c @@ -0,0 +1,29 @@ +#include + +int main(){ + float valor; + scanf("%f", &valor); + if(valor > 75 && valor <= 100){ + printf("Intervalo (75,100]\n"); + } + else { + if(valor > 50 && valor <= 75){ + printf("Intervalo (50,75]\n"); + } + else { + if(valor > 25 && valor <= 50) { + printf("Intervalo (25,50]\n"); + } + else { + if(valor >= 0 && valor <= 25) { + printf("Intervalo [0,25]\n"); + } + else { + printf("Fora de intervalo\n"); + } + } + } + } + + return 0; +} diff --git a/1. Iniciante/1038.c b/1. Iniciante/1038.c new file mode 100644 index 0000000..b9d2b54 --- /dev/null +++ b/1. Iniciante/1038.c @@ -0,0 +1,21 @@ +#include + +int main(){ + int cod, quant = 0; + double valor = 0; + scanf("%d %d", &cod, &quant); + switch(cod){ + case 1 : valor = quant * 4.00; + break; + case 2 : valor = quant * 4.50; + break; + case 3 : valor = quant * 5.00; + break; + case 4 : valor = quant * 2.00; + break; + case 5 : valor = quant * 1.50; + break; + } + printf("Total: R$ %.2lf\n", valor); + return 0; +} diff --git a/1. Iniciante/1043.c b/1. Iniciante/1043.c new file mode 100644 index 0000000..dde022a --- /dev/null +++ b/1. Iniciante/1043.c @@ -0,0 +1,18 @@ +#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("Perimetro = %.1f\n", a + b + c); + } + else + { + printf("Area = %.1f\n", c * (a + b) / 2); + } + return 0; + +} \ No newline at end of file diff --git a/1. Iniciante/1044.c b/1. Iniciante/1044.c new file mode 100644 index 0000000..4b67907 --- /dev/null +++ b/1. Iniciante/1044.c @@ -0,0 +1,13 @@ +#include + +int main(){ + int a, b; + scanf("%d %d", &a, &b); + if((a % b == 0) || (b % a == 0)){ + printf("Sao Multiplos\n"); + } + else{ + printf("Nao sao Multiplos\n"); + } + return 0; +} diff --git a/1. Iniciante/1048.c b/1. Iniciante/1048.c new file mode 100644 index 0000000..b7b79ca --- /dev/null +++ b/1. Iniciante/1048.c @@ -0,0 +1,34 @@ +#include + +int main(){ + int percent; + float novo, reajuste, sal; + scanf("%f", &sal); + if(sal <= 400){ + percent = 15; + } + else{ + if(sal <= 800){ + percent = 12; + } + else{ + if(sal<= 1200){ + percent = 10; + } + else{ + if(sal<= 2000){ + percent = 7; + } + else{ + percent = 4; + } + } + } + } + reajuste = (sal * percent) / 100; + novo = sal + reajuste; + printf("Novo salario: %.2f\n", novo); + printf("Reajuste ganho: %.2f\n", reajuste); + printf("Em percentual: %d %%\n", percent); + return 0; +} diff --git a/1. Iniciante/1050.c b/1. Iniciante/1050.c new file mode 100644 index 0000000..3142a07 --- /dev/null +++ b/1. Iniciante/1050.c @@ -0,0 +1,27 @@ +#include + +int main(){ + int num, cidade = 0; + scanf("%d", &num); + switch(num) { + case 61 : printf("Brasilia\n"); + break; + case 71 : printf("Salvador\n"); + break; + case 11 : printf("Sao Paulo\n"); + break; + case 21 : printf("Rio de Janeiro\n"); + break; + case 32 : printf("Juiz de Fora\n"); + break; + case 19 : printf("Campinas\n"); + break; + case 27 : printf("Vitoria\n"); + break; + case 31 : printf("Belo Horizonte\n"); + break; + default: printf("DDD nao cadastrado\n"); + + } + return 0; +} diff --git a/1. Iniciante/1052.c b/1. Iniciante/1052.c new file mode 100644 index 0000000..954c70e --- /dev/null +++ b/1. Iniciante/1052.c @@ -0,0 +1,44 @@ +#include + +int main(){ + int mes; + scanf("%d", &mes); + switch(mes){ + 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"); + } + return 0; +} \ No newline at end of file diff --git a/1. Iniciante/1059.c b/1. Iniciante/1059.c new file mode 100644 index 0000000..d5666f3 --- /dev/null +++ b/1. Iniciante/1059.c @@ -0,0 +1,9 @@ +#include + +int main(){ + int i = 0; + for (i = 2; i <= 100; i = i + 2){ + printf("%d\n", i); + } + return 0; +} diff --git a/1. Iniciante/1060.c b/1. Iniciante/1060.c new file mode 100644 index 0000000..d7f2975 --- /dev/null +++ b/1. Iniciante/1060.c @@ -0,0 +1,14 @@ +#include + +int main(){ + float v; + int i, f = 0; + for (i = 0;i < 6;i++){ + scanf("%f", &v); + if(v > 0){ + f = f + 1; + } + } + printf("%i valores positivos\n", f); + return 0; +} diff --git a/1. Iniciante/1061.c b/1. Iniciante/1061.c new file mode 100644 index 0000000..58c51ba --- /dev/null +++ b/1. Iniciante/1061.c @@ -0,0 +1,29 @@ +#include +int main(){ + int dia, diafim, hora, horafim, minuto, minutofinal, segundo, segundofinal; + scanf("Dia %d", &dia); + scanf("%d : %d : %d\n", &hora, &minuto, &segundo); + scanf("Dia %d", &diafim); + scanf("%d : %d : %d", &horafim, &minutofinal, &segundofinal); + segundo = segundofinal - segundo; + minuto = minutofinal - minuto; + hora = horafim - hora; + dia = diafim - dia; + if (segundo < 0){ + segundo += 60; + minuto--; + } + if (minuto < 0){ + minuto += 60; + hora--; + } + if (hora < 0){ + hora += 24; + dia--; + } + printf("%d dia(s)\n", dia); + printf("%d hora(s)\n", hora); + printf("%d minuto(s)\n", minuto); + printf("%d segundo(s)\n", segundo); + return 0; +} diff --git a/1. Iniciante/1064.c b/1. Iniciante/1064.c new file mode 100644 index 0000000..ff158b8 --- /dev/null +++ b/1. Iniciante/1064.c @@ -0,0 +1,17 @@ +#include + +int main(){ + float v = 0, mp = 0; + int i, f = 0; + for (i = 0;i < 6;i++){ + scanf("%f", &v); + if(v > 0){ + f = f + 1; + mp = v + mp; + } + } + printf("%i valores positivos\n", f); + mp = mp / f; + printf("%.1f\n", mp); + return 0; +} diff --git a/1. Iniciante/1065.c b/1. Iniciante/1065.c new file mode 100644 index 0000000..1008bd4 --- /dev/null +++ b/1. Iniciante/1065.c @@ -0,0 +1,13 @@ +#include + +int main(){ + int i, par=0, n; + for(i=0;i<5;i++){ + scanf("%d", &n); + if(n%2 == 0){ + par+=1; + } + } + printf("%d valores pares\n", par); + return 0; +} diff --git a/1. Iniciante/1070.c b/1. Iniciante/1070.c new file mode 100644 index 0000000..3ed0e1c --- /dev/null +++ b/1. Iniciante/1070.c @@ -0,0 +1,14 @@ +#include + +int main(){ + int i = 0, v = 0; + scanf("%d", &v); + if (v % 2 == 0){ + v = v + 1; + } + for(i = 0; i < 6; i++){ + printf("%d\n", v); + v = v + 2; + } + return 0; +} diff --git a/1. Iniciante/1072.c b/1. Iniciante/1072.c new file mode 100644 index 0000000..f361c38 --- /dev/null +++ b/1. Iniciante/1072.c @@ -0,0 +1,18 @@ +#include + +int main(){ + int n, x, i, in = 0, out = 0; + scanf("%d", &n); + for(i = 1; i <= n; i++){ + scanf("%d", &x); + if(x >= 10 && x <= 20){ + in++; + } + else{ + out++; + } + } + printf("%d in\n", in); + printf("%d out\n", out); + return 0; +} diff --git a/1. Iniciante/1073.c b/1. Iniciante/1073.c new file mode 100644 index 0000000..77f2ee4 --- /dev/null +++ b/1. Iniciante/1073.c @@ -0,0 +1,12 @@ +#include +#include + +int main(){ + int i, x, r; + scanf("%d", &x); + for(i=2;i<=x;i+=2){ + r = pow(i,2); + printf("%d^2 = %ld\n", i, r); + } + return 0; +} diff --git a/1. Iniciante/1080.c b/1. Iniciante/1080.c new file mode 100644 index 0000000..0a05761 --- /dev/null +++ b/1. Iniciante/1080.c @@ -0,0 +1,15 @@ +#include + +int main(){ + int i, x, mv = 0, pos = 0; + for(i = 1; i <= 100; i++){ + scanf("%d", &x); + if(x > mv){ + mv = x; + pos = i; + } + } + printf("%d\n", mv); + printf("%d\n", pos); + return 0; +} diff --git a/1. Iniciante/1094.c b/1. Iniciante/1094.c new file mode 100644 index 0000000..0afe9f4 --- /dev/null +++ b/1. Iniciante/1094.c @@ -0,0 +1,34 @@ +#include + +int main(){ + int N = 0, num = 0, qc = 0, qr = 0, qs = 0, i, total = 0; + double pc = 0, pr = 0, ps = 0; + char tipo; + scanf("%d", &N); + for(i = 1; i <= N; i++){ + scanf("%d %c", &num, &tipo); + switch(tipo){ + case 'C': + qc = qc + num; + break; + case 'R': + qr = qr + num; + break; + case 'S': + qs = qs + num; + break; + } + } + total = qc + qr + qs; + pc = (qc * 100.0) / total; + pr = (qr * 100.0) / total; + ps = (qs * 100.0) / total; + printf("Total: %d cobaias\n", total); + printf("Total de coelhos: %d\n", qc); + printf("Total de ratos: %d\n", qr); + printf("Total de sapos: %d\n", qs); + printf("Percentual de coelhos: %.2lf %\n", pc); + printf("Percentual de ratos: %.2lf %\n", pr); + printf("Percentual de sapos: %.2lf %\n", ps); + return 0; +} diff --git a/1. Iniciante/1095.c b/1. Iniciante/1095.c new file mode 100644 index 0000000..3b8a11d --- /dev/null +++ b/1. Iniciante/1095.c @@ -0,0 +1,10 @@ +#include + +int main(){ + int i = 1, j; + for(j=60;j>=0;j-=5){ + printf("I=%d J=%d\n", i, j); + i+=3; + } + return 0; +} diff --git a/1. Iniciante/1096.c b/1. Iniciante/1096.c new file mode 100644 index 0000000..22571bb --- /dev/null +++ b/1. Iniciante/1096.c @@ -0,0 +1,11 @@ +#include + +int main(){ + int i, j; + for(i=1;i<=9;i+=2){ + for(j=7;j>=5;j--){ + printf("I=%d J=%d\n", i, j); + } + } + return 0; +} diff --git a/1. Iniciante/1098.c b/1. Iniciante/1098.c new file mode 100644 index 0000000..255d0dc --- /dev/null +++ b/1. Iniciante/1098.c @@ -0,0 +1,36 @@ +#include +int main() + +{ + + float i, j, valor; + + int temp, temp2; + + for (i = 0, j = 1, valor = 0, temp = 0, temp2 = 0; i < 2.2; j++) + { + if(temp2 == 0){ + printf("I=%.0f J=%.0f\n", i, j); + }else{ + printf("I=%.1f J=%.1f\n", i, j); + } + temp++; + + if(temp == 3){ + + i += 0.2; + + valor += 0.2; + + j = valor; + + temp = 0; + + temp2++; + } + if(temp2 == 5) + + temp2 = 0; + } + return 0; +} diff --git a/1. Iniciante/1101.c b/1. Iniciante/1101.c new file mode 100644 index 0000000..0724de8 --- /dev/null +++ b/1. Iniciante/1101.c @@ -0,0 +1,21 @@ +#include + +int main(){ + int m, n, soma=0, f, i; + scanf("%d %d", &m, &n); + while(m > 0 && n > 0){ + if(n>m){ + f = m; + m = n; + n = f; + } + for(i=n;i<=m;i++){ + printf("%d ", i); + soma+=i; + } + printf("Sum=%d\n", soma); + soma=0; + scanf("%d %d", &m, &n); + } + return 0; +} diff --git a/1. Iniciante/1113.c b/1. Iniciante/1113.c new file mode 100644 index 0000000..f7c2a99 --- /dev/null +++ b/1. Iniciante/1113.c @@ -0,0 +1,16 @@ +#include + +int main(){ + int x, y; + scanf("%d %d", &x, &y); + while(x != y){ + if(x>y){ + printf("Decrescente\n"); + } + else{ + printf("Crescente\n"); + } + scanf("%d %d", &x, &y); + } + return 0; +} diff --git a/1. Iniciante/1172.c b/1. Iniciante/1172.c new file mode 100644 index 0000000..b7c775c --- /dev/null +++ b/1. Iniciante/1172.c @@ -0,0 +1,18 @@ +#include + + int main(){ + int i; + int X[10]; + for(i=0;i < 10; i++){ + scanf("%d", &X[i]); + if(X[i] <= 0){ + X[i] = 1; + } + } + + for(i=0; i <10; i++){ + printf("X[%d] = %d\n", i, X[i]); + } + + return 0; + } \ No newline at end of file diff --git a/1. Iniciante/1173.c b/1. Iniciante/1173.c new file mode 100644 index 0000000..4a13438 --- /dev/null +++ b/1. Iniciante/1173.c @@ -0,0 +1,13 @@ +#include +#include + +int main(){ + int i, v; + scanf("%d", &v); + int n[10] = {v}; + for(i=0;i<10;i++){ + printf("N[%d] = %d\n", i, n[i]); + n[i+1] = n[i] * 2; + } + return 0; +} diff --git a/1. Iniciante/1174.c b/1. Iniciante/1174.c new file mode 100644 index 0000000..c04f696 --- /dev/null +++ b/1. Iniciante/1174.c @@ -0,0 +1,15 @@ +#include + +int main(){ + float vet[100]; + int i; + for(i=0;i<100;i++){ + scanf("%f", &vet[i]); + } + for(i=0;i<100;i++){ + if(vet[i] <= 10){ + printf("A[%d] = %.1f\n", i, vet[i]); + } + } + return 0; +} diff --git a/1. Iniciante/1175.c b/1. Iniciante/1175.c new file mode 100644 index 0000000..bd8ffc7 --- /dev/null +++ b/1. Iniciante/1175.c @@ -0,0 +1,14 @@ +#include +#include + +int main(){ + int n[20], m[20], i; + for(i=0;i<20;i++){ + scanf("%d", &n[i]); + m[19-i] = n[i]; + } + for(i=0;i<20;i++){ + printf("N[%d] = %d\n", i, m[i]); + } + return 0; +} diff --git a/1. Iniciante/1180.c b/1. Iniciante/1180.c new file mode 100644 index 0000000..a1dd0b4 --- /dev/null +++ b/1. Iniciante/1180.c @@ -0,0 +1,20 @@ +#include + +int main(){ + int n, i, pos; + scanf("%d", &n); + int x[n]; + for(i=0;i + +int main(){ + int c, i, j; + double mat[12][12]; + double calc = 0.0; + char t[2]; + scanf("%d", &c); + scanf("%s", &t); + for(i=0;i<12;i++){ + for(j=0;j<12;j++){ + scanf("%lf", &mat[i][j]); + //mat[i][j] = rand()%100; + //printf("%3.1lf ", mat[i][j]); + } + //printf("\n"); + } + for(i=0;i<12;i++){ + calc = calc + mat[i][c]; + } + switch(t[0]){ +case 'S': printf("%.1lf\n", calc); + break; +case 'M': printf("%.1lf\n", calc / 12.0); + break; + } + + return 0; +} diff --git a/1. Iniciante/1184.c b/1. Iniciante/1184.c new file mode 100644 index 0000000..537d777 --- /dev/null +++ b/1. Iniciante/1184.c @@ -0,0 +1,32 @@ +#include + +int main(){ + double M[12][12]; + double soma = 0.0; + int i, j, c = 0; + char O[2]; + scanf(" %s", &O); + for(i=0;i<12;i++){ + for(j=0;j<12;j++){ + scanf("%lf", &M[i][j]); + //M[i][j] = rand()%100; + //printf("%.1lf ", M[i][j]); + } + //printf("\n"); + } + for(i=1;i<12;i++){ + for(j=0;j