Leer 500 números enteros y obtener cuantos de ellos son positivos?
Leer 500 números enteros y obtener cuantos de ellos son positivos. PORFAVOR PASEN ESA TAREA EN LENGUAJE C.
Leer 500 números enteros y obtener cuantos de ellos son positivos. PORFAVOR PASEN ESA TAREA EN LENGUAJE C.
Código en Dev c + + - - - - - - - - - - - - - - - - - - - - - - - - - - -
#include
#include
int main(){
int i, x, cant ;
cant = 0 ;
for(i = 1 ; i0){ cant = cant + 1 ; }
} printf(" \ nSon positivos : %i \ n", cant) ;
return 0 ;
} / / - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - / / Codigo alternativo
#include
#include
int main(){ int i, x, cant, n ; cant = 0 ; printf("Ingresar una cantidad : ") ; scanf("%d", &n) ; for(i = 1 ; i0){ cant = cant + 1 ; } } printf(" \ nSon positivos : %i \ n", cant) ;
return 0 ;
}
Saludos.
Aqui tienes tu algoritmo en c + + , trata de entenderlo para que lo puedas explicar. / / Leer 20 números enteros e imprimir cuantos son / / positivos, cuantos negativos y cuantos neutros. #include using namespace std ;…
Hola. Como el algoritmo no indica si los números se ingresan por teclado o se asignan directamente, el algoritmo que propongo los pide ingresar por teclado. Mediante un bucle PARA, pedimos el ingreso de los 10 números y…
Espero que te sirva : import java. Util. * ; import java. Io. * ; public class Main { public static void main(String[] args) throws IOException{ Scanner sc = new Scanner(System. In) ; int n, cifras ; char car ; do{…