Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
AVANCE 1 TAREA M4 - PERLAS
Language:
Ada
Assembly
Bash
C#
C++ (gcc)
C++ (clang)
C++ (vc++)
C (gcc)
C (clang)
C (vc)
Client Side
Clojure
Common Lisp
D
Elixir
Erlang
F#
Fortran
Go
Haskell
Java
Javascript
Kotlin
Lua
MySql
Node.js
Ocaml
Octave
Objective-C
Oracle
Pascal
Perl
Php
PostgreSQL
Prolog
Python
Python 3
R
Rust
Ruby
Scala
Scheme
Sql Server
Swift
Tcl
Visual Basic
Layout:
Vertical
Horizontal
#include <stdio.h> #include <stdlib.h> typedef unsigned long UL; typedef unsigned long long ULL; // ----------------Prototipos----------------------- UL *input(UL *, ULL *); void output(UL *, ULL); // ---------------Función Principal----------------- int main(void) { UL *perlas; ULL total ; while (1) { perlas = NULL; total = 0; perlas = input(perlas, &total); if (total == 0) break; if ( total % 2 == 0 ) printf("NO\n"); else { printf("%llu\n", total); //printf("%lu\n", perlas[0]); output(perlas, total); } } return 0; } // ----------------------Funciones-------------------- UL *input(UL *ptrPerlas, ULL *N) { UL diametro; UL *ptrAux = ptrPerlas; do { scanf("%lu", &diametro); if ( diametro == 0 ) break; ptrPerlas = (UL *) realloc(ptrPerlas, sizeof(UL) * ( (*N) + 1 ) ); if ( ptrPerlas == NULL) exit(EXIT_FAILURE); ptrPerlas[*N] = diametro; (*N) ++; }while(1); return ptrPerlas; } void output(UL *perlas, ULL N) { ULL i; for ( i = 0 ; i < N ; i ++ ) printf("%lu ", perlas[i]); printf("\n"); }
gcc
2 3 2 3 5 7 5 0 2 2 7 10 0 10 0 1 1 1 1 1 0 1 2 1 2 1 1 3 0 0
Show compiler warnings
[
+
] Compiler args
[
-
]
Show input
Compilation time: 0.13 sec, absolute running time: 0.21 sec, cpu time: 0.06 sec, memory peak: 3 Mb, absolute service time: 0,43 sec
edit mode
|
history
|
discussion
7 2 3 2 3 5 7 5 NO 1 10 5 1 1 1 1 1 7 1 2 1 2 1 1 3