generate functionMon, 22 May 2023

Elabore un algoritmo que lea 5 números obtenga el total, el promedio y determine si el total es par o impar

#include <stdio.h> #include <stdlib.h> int main() { int n1, n2, total, promedio; printf("ingrese un numero: "); scanf("%d", &n1); printf("ingrese un numero: "); scanf("%d", &n2); total=n1+n2; promedio=(n1+n2)/2; printf("La suma es: %d\n",total); printf("El promedio es: %d\n",promedio); if(total%2==0){ printf("El numero es par\n"); }else{ printf("El numero es impar\n"); } return 0; }

Questions about programming?Chat with your personal AI assistant