FORUM
Pagina de start a forumului eggzit.3xforum.ro
Lista Forumurilor Pe Tematici
FORUM | Reguli | Inregistrare | Login

POZE FORUM

Nu sunteti logat.
Nou pe simpatie:
Sabina la Simpatie.ro
Femeie
25 ani
Bucuresti
cauta Barbat
25 - 63 ani
FORUM / Forum Nou / 12  
Autor
Mesaj Pagini: 1
eggzit
Username: 6R9PKQUKKU

Inregistrat: acum 20 ani
Postari: 215
{fie o matrice cu n linii si m coloane ce contine
nr naturale---mat.out...numar superprim}
program doisprezece;
var a:array[1..10,1..10]of integer;
    n,m,i,j:integer;  f:text;
function superprim(n:integer):boolean;
var inv,m,i:integer;ok:boolean;
begin
inv:=0;
m:=n;
while m>0 do
       begin
       inv:=inv*10+ m mod 10;
       m:=m div 10;
       end;
ok:=true;
for i:=2 to n div 2 do
     if n mod i=0 then ok:=false;
for i:=2 to inv div 2 do
     if inv mod i=0 then ok:=false;
superprim:=ok;
end;
begin
assign(f,'mat.out');
rewrite(f);
write('n=');readln(n);
write('m=');readln(m);
for i:=1 to n do
     for j:=1 to m do
         begin
         write('a[',i,',',j,']=');
         readln(a[i,j]);
         end;
for i:=1 to n do
    for j:=1 to m do
         if superprim(a[i,j]) then write(f,a[i,j],' ');
close(f);
end.


pus acum 18 ani
   
Pagini: 1  

Mergi la