Pascal/Turbo Pascal - AYUDA PROGRAMAS SENCILLOR CICLOS REPETITIVOS

 
Vista:
sin imagen de perfil

AYUDA PROGRAMAS SENCILLOR CICLOS REPETITIVOS

Publicado por Malic (7 intervenciones) el 16/03/2016 19:39:38
Hola ,porfavor necesoto ayuda con dos programas de PAscal porfavor..

1) Implemente un programa que muestre en pantalla el numero de divisores que tiene N y M(introducidos desde el teclado) por ejemplo si son 4 divisores pues sale 4

2)Implemente un programa que muestre los primeros N numeros naturales de dos cifras cuya cifra de unidades es menor que la cifra de las decimas.Ejemplo: N=7 entonces 10,20,21,30,31,32,40
**Este es mas complicado no lo entendi nada**
PORFAVOR LES RUEGO SI ME PUEDEN AYUDAR LES ESTARIA MUY AGRADECIDA MUCHAS GRACIAS!!
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

AYUDA PROGRAMAS SENCILLOR CICLOS REPETITIVOS

Publicado por dario (42 intervenciones) el 18/03/2016 05:41:09
Esto es lo que quieres.
Ejercicio Nro 1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
uses crt;
var
    n,m,i,c,x:integer;
begin
    clrscr;
    write('Ingrese valor de n: ');
    readln(n);
    write('Ingrese valor de m: ');
    readln(m);
 
    for i:=1 to n do begin
        if n mod i = 0 then
            inc(c);
    end;
    writeln(n,' tiene ',c,' divisores');
 
    for i:=1 to m do begin
        if m mod i = 0 then
            inc(x);
    end;
    writeln(m,' tiene ',x,' divisores');
    readkey;
end.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

AYUDA PROGRAMAS SENCILLOR CICLOS REPETITIVOS

Publicado por ramon (2158 intervenciones) el 26/03/2016 13:59:29
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
{mira esto}
 
program divisores;
 uses
   crt;
 
  var
    num1, num2 : word;
    r : integer;
    divisor : integer;
 
 
   function divisoresson(nu : word) : integer;
   begin
      divisoresson := 0;
      divisor := 0;
       for r := 1 to nu do
        if (nu mod r) = 0 then
        divisor := divisor + 1;
       divisoresson := divisor;
   end;
 
   procedure respuesta;
   begin
      clrscr;
      writeln('   Divisores De dos Numeros ');
      writeln;
      write('   Entre Primer Numero  : ');
      readln(num1);
      write('   Entre Segundo Numero : ');
      readln(num2);
      writeln('  Los Divisores De ',num1,' Son :

',divisoresson(num1));
      writeln('  Los Divisores De ',num2,' Son :

',divisoresson(num2));
      readkey;
   end;
 
   procedure numeros_naturales;
   var
     numer : integer;
     dat : string[2];
     t, j, k : integer;
     sal : boolean;
     tec : char;
   begin
       clrscr;
       writeln('     Numeros Naturales De Dos Cifras');
       writeln;
       write('   Numero 1 al 9 : ');
       sal := false;
     repeat
        tec := readkey;
        if tec in['1'..'9'] then
        sal := true;
     until sal = true;
     j := 1;
     t := 1;
    repeat
        k := 10 * t;
        sal := false;
        j := 0;
      repeat
        str(k,dat);
        if dat[1] > dat[2] then
        begin
        write('  ',k);
        j := j + 1;
        k := k + 1;
        end
      else
         begin
            sal := true;
         end;
      until (j > 10) or (sal = true);
      if j > 0 then
      t := t + j;
      t := t + 1;
    until t > ord(tec) - 48;
   end;
 
 
 
   begin
       clrscr;
       respuesta;
       readkey;
       writeln;
       numeros_naturales;
       readkey;
   end.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar