Está en la página 1de 4

=>JERCICIOS

DEBERES:

IHacer unprogramaque demelvaa


suma alosmineraiere de
14 mins)

PRIMO:decir
#
siu n número es primo o no Charia falta validar)
2. Hacer un programa de 3x+1: dado nimero
1 introducido por el usuario

conREne

I
#incudesen
dice
↳ (2 mins)
i)

idevoveral#deiteracio ene
si el nimero es pars:
2

atacondias
en i) si el número el impar (x3) 1

" inntroduzca
- +

un numero: e 1-34 52 26 1 3 13 40
1 20 10 5
+
16 8 4 2 1> i t 14
=
+ - - +
- - + + - - + + +

nen,enes
el primo
scanf("d", &
num) primo:
1 - asumimos que num

it

i (amnumcomminma for,i=2: immum


3.

:
*
*

es divisible e n introducida por el usuario.

belsel

I printfl"
return o;

3
Enimero no es primo"),

innerOmee #1 #include

int main
<stdio.h>

(void)

I
int num;
it
imm,mo; int sma;
" do

#FACTORIAL:de

int num;
un nim introducide por el usuario (haria falta
validar)
I 'print fl"introduzca un
I scanf(".d", Onum);
swnice
número positivo:");

in fat; ! (numsaiif(meE,
suma:o r inicializamos numero debe ser i
printf (" Introduce un him:");

I or inum,agente
al neutro

scant(",d", Onum);
fact=1

for li=1;
isnm;i t )4 +

E
fact fact xi iacumulacion tenemos are tener algo algo
a y
erintf("casuma es id", suma);

Pintf)" El factorial de T.d es y.d.", Num, fact


CORRECCION #2
#includetdi.
es

I Ii
** inia;
i
int i;
# TRIANGULO

ima,sere
int mumalt;
inth;

in?,
,leer
y validar n
y validarlo

for(i 1, i c h , i
= +

H)) foria:Flashtia; numant e

iYar'e
!printf("*");

Iwintis
Printo final,
I
elseh

return 0;
InmenumAStas
Bate num
A
#TRIANGULO
de iteraciones es; a", en

#include sstdio.n

int main (void)[

i
3
#

inthama
#include <stdio.h);
int
num_el; int main(void)

in whasen
i
int
h,leer y validar h

mas"
int,
en anoste;exactarniacotaal
fila
fo r (num_el fila;num-el++)
z ;num-el

formmatr:
=

en
numt printf("-");
if (num == 10)

"
I
num 1 ; =

mmastnia;amasen
bessel printf(" *");

iiiae
! #PROGRAMA QUE
L EA
En maintwombe have usando funciones d e este

Iprint sni;
#include stdio.n)

int main (void) S


returno; ,int alum, n

int-asis IN e
#INVERTIR UN NUMERO: num introducido por el usuario de num digitos desconocide. i char (N)M7 nombres

int

, tat
include
#
<stdio.h) i,j;
int main (void)S
notamosen
i
int
num;
int nevo;
neVO 0 =

printf ("Introduce un numero:"); , for li 0;i


nalum;itt

aus
=
<

scant (" d", Onum);


! ! foro,casian, oel alumno jd: "jtz, itis

i aux= nevo %.
10; !
i scant ("17", & notas (i)(i));

i
,
nevo n evo * 10+Aux
=

i mm nom, o;
= for Ii=0,i c h alumnos;it) d

i
swnice (num!=0); printf( Intro nombre alumno d, it 1,

i fflsh(stdin);
resultadde
Mostrar fgets (nombres (i), stain);
i
N,

I
,
limpiar cadena
(aude,teen nombre (i)-1)) = .e

I E

y notamax:
NotaMediaMax/notas, n.alum, n-arig, nombre, alumnomax),
float NotaMax
(float/1(N), int nalum, inthang, char nombres()(m), char allmax)1);

i float not amax, no es

for (i 0;i < nasig;


=
it + 14
i
float Notariawmamatempranawm, intrang,
charnombress

* terminar
VECTORES
# MATRICES Y
#FUNCION GOLBACH

#Include <stdio.hL
#include stdio.h>

void Cifrar (int v1I), intn,


intr2();
int comointa, int ebrimos, interio de
int main (voidh int main (void)(
int primo 1, primo 2;

Yoid citrar lint vall, int n, intral d


i int
int
num;
valor;
do

i
i nianima
internet
In;
!printt),numero,en .

mensajeenOra. en
if (nmy. 21 0
= 11 Num<2)
cowm;
printf)"El num debe ser par y s2')

#ALCORITMO DE ORDENACION UN VECTOR Isin usar


DE recaux)
Wances me armon;
"
(574 ere !printf("secumple y el num y.d=y.dAY.d", num, primos,
primoz,
selse(
include
# <stdio.h>

Printf," no se
cumple");
int main (void)
I
returno,

hae
Portanantirimoz,
int es
"
intxaaie
751 4
I

signi
for 5714

i i
if (reclik rect(j)) aux=vectil;
ral 0; =

i
perdemos
rect (i) rect(i);-asi
=

for li
z ,i nmIz,i t Hd
(i):t i l ;auxinto.
=
<

i
rect
esprimo 1 primo
=

(i);
if (esprimo 1 ==
1) [

"
DEBERES:

#Hacerunprogramacompletoquevidaun vectordenotasinvalidardimAiatir deesteobtenerantera


codificar Función suma de 4 formas:
en

# include <stdio.n>
#include <stdio.h)
#Include <stdlib.h>
1) int suma (inta, intb);
main (roid)(
cint suma,int*Pa,intere l
int

4) void Suma lintA pa, int *Pb, intxPSumal;


intdim,dimupe
float *
aprobados;
h

inter
int main (void)

!
vahar en
intx, y;

all,
int resultado;
4) [
Il leer y validar
Printfl" Introduce italis
i(*
la nota de la asignatura y

i
Suma) (*xa) (*pb);
=
+

scant ("d", 8 (i));

.jj
1)resultado: notan
Suma(X,y);
return
if Inotan (i) co Il notas c i 10
i
2) resultado Sumal&x, &y);3
=

annof a El valor debe estar entre el aba tole


3) Suma (X, y, a recutadol;

i
14) Suma (Ox, 2 y, Orecultado); while Inotan (i) O Il notal (i) 10

dimapro 0 ;

ii
=

# PROGRAM TO ANALYSE Ta OF 3 CITIES


forlizo, icdim; inte

#include <stdio.h if (notal (i) = 5 mejor con define

#Include <stdlib.h) , dimaprott


3
deen
114rOtOtiPOS I
aprobado Coat*lcalloc Cdimapro, size ofoall,
int main
(Vaa
-

+lo at
i
i
float tem (NTIM7; r if(aprobados =
NulL)(
=

floatem,
int , Printfl
beiseh
Error arighando memoria. "I,

int numtemax;w
I

!I
intemax, i
j 0; Nohabia rellenade
=

i maxn_t, overave;

!!
dimapro 0 ; =
el vector!!!
Readmat (tem); i++)4
!
for (i=0 ;i c dim;

! media =
AverageTemp (tem);
(*numtem ax) 0;
if inutalsinRRO S

"mtemainmedialIenareen
=

, for (i 0;i c N; i +)
=

for (i=0,is dimaprobii t 1) S

! !for1j 0;j m,j +))


<
=

'Printf (" la asignatura i.d con un I.dIn", it 1)


i
i de Average
tree
(aprobados);
.
returno;

! if (temax NULL) ( = =

I
Printf)"Error
, arignando memoria."),
float AverageTemp (Hoat
I
beiseh tem () (m), in +xn)

naineda",
IDEA IMD:
I
*

I citynum-lint*) calloccaumtemax, size of (intll,


maxn-t 0 ;

!
=

I Il it (cityrum 0) ==
for m,j +))
....

selseh am;"e90; (y 0,j


= < +

I !
tempity
Item, media, tmax, city me en
i i overave 0 ; =

! !forsi-vivamitiene for (i 0;icN i +))


=

;
+

!
! !if (tem(illi) avel
!
I
3

, overavent
I
I returno; ↳
/N*M,
roid Readmat (Hoattem /7/M7); , media suma

return media; maxn-+) S


if coveraves=
intii; ,
I for flodt media 1 I maxn-t= overare;
(i 0;i <
=

N;i +)) void Fill-temp-and -City (float temax (), intcitynum (), emax)(

invaras.
+

force miscalatemperatura
!int i,j, k;

en i k 0;=

I
for (i 0,i N,i t t)
ya el dia 7.d:"(i,j);
c
S
=

ciudad

i I Is
for

. I
Scanf)" if", 0,j M, jtH free (
(i)(i));
=
tem

·if Item liaue?,e lt);

"I
tree
E
return; atonuminis return o
modificar la posiciones
#Esmibirlalineadecodnecesarata COMPLETAR INFO:
#

#Include <stdio.h>
completaratot-acouctoresintereses
void
Lentes (26);dri.
de 4 t #define N30

i
VECAOr T_PAC int i;
m typedef struct
j0
=

me
lint
1
T - PAC

for li 0; i<dim,itH)
-
=

numero-codigo,

!
char titulo IN);
Lectores (i). gasto =

, char autor (N); Lectores (i). gasto libros. Precio


a

(j);
float precio;

" T.
, jtt;
UBRO
1i n t
Char Buscarlibro (T_LiBRO vlibros, intn)S

;
typedf stuct h inti;

i
JUNIO
#

08 char nombre (N),


typedef struct #incrdestinoen
ver, int, char amno, Hoatatal int

int
id numere;

rcodigo (N),
for li = 0;i< n;i +)
+

Char (m];
nombre
1) Introducimos nombre, validamos con stramp si sale I int
ne;
float not as (N); floatgasto;
I

SI-AWNNO. 3 5-LECTOR;

También podría gustarte