1 / 5

program stroki_1; uses crt; var a:array[1..10] of string; st:string;

Разобрать предложение на слова. program stroki_1; uses crt; var a:array[1..10] of string; st:string; i,n,j,k:integer; begin clrscr; readln(st); n:=length(st); k:=0; for i:=1 to n do if st[i]=' ' then inc(k); j:=1; for i:=1 to n do

ryan-gibson
Download Presentation

program stroki_1; uses crt; var a:array[1..10] of string; st:string;

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Разобрать предложение на слова program stroki_1; uses crt; var a:array[1..10] of string; st:string; i,n,j,k:integer; begin clrscr; readln(st); n:=length(st); k:=0; for i:=1 to n do if st[i]=' ' then inc(k); j:=1; for i:=1 to n do if st[i]=' ' then inc(j) else a[j]:=a[j]+st[i]; for i:=1 to j do writeln(a[i]); writeln; readkey; end.

  2. Найти сумму цифр числа program stroki_2; uses crt; var a:string; i,n,s,k,x:integer; begin clrscr; readln(a); n:=length(a); s:=0; for i:=1 to n do begin val(a[i],x,k); s:=s+x; end; writeln('s=',s); writeln; readkey; end.

  3. Определить является ли число введенное с клавиатуры, числом Армстронга program stroki_3; uses crt; var a:string; i,n,k,x,st,j:integer; ch1,ch2:integer; begin clrscr; readln(a); n:=length(a); ch1:=0; for i:=1 to n do begin val(a[i],x,k); st:=1; for j:=1 to n do st:=st*x; ch1:=ch1+st; end; val(a,ch2,k); writeln(ch1:6,ch2:6); if ch1=ch2 then writeln('chislo armstronga') else writeln('net'); writeln; readkey; end.

  4. Перевод числа из В-ричной системы счисления (В<10) в десятичную систему счисления program stroki_4; uses crt; var a:string; b,i,n,k,x,st,s:integer; begin clrscr; readln(a); readln(b); n:=length(a); s:=0; st:=1; for i:=1 to n do begin val(a[n-i+1],x,k); s:=s+x*st; st:=st*b; end; writeln(s); readkey; end.

  5. Перевод числа из десятичной системы счисления в В-ричную систему счисления program stroki_5; uses crt; var a,b,x,s,k,i:integer; st,st1:string; begin clrscr; readln(a); readln(b); s:=0; while a<>0 do begin x:=a mod b; s:=s*10+x; a:=a div b; end; str(s,st); k:=length(st); for i:=k downto 1 do write(st[i]); readkey; end.

More Related