16/11/2022 ; 5:28 PM

This commit is contained in:
2022-11-16 17:32:01 -04:00
parent 6ca133770c
commit 5530947414
17 changed files with 512 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
#include <stdio.h>
/* Suma positivos.
El programa, al recibir como datos N números enteros, obtiene la suma de los
➥enteros positivos.
I, N, NUM, SUM: variables de tipo entero. */
void main(void)
{
int I, N, NUM, SUM;
SUM = 0;
printf("Ingrese el número de datos: \t");
scanf("%d", &N);
for (I = 1; I <= N; I++)
{
printf("Ingrese el dato número %d: \t", I);
scanf("%d", &NUM);
if (NUM > 0)
SUM = SUM + NUM;
}
printf("\nLa suma de los números positivos es: %d", SUM);
}