Forgotten password

Language

Bulgarian    English

Advertisements




Report a bug !
Add search function to you browser

Powered by PHP Powered by MySQL
Pascal емулатор
1 member(s) online
Size control Print  Language: Pascal

Examples://Code arrange


To solve the problem you should shift the code with your mouse to end up with working solution.

Problem:
Let x be real and n-an integer. Write down a program that calculates the value of the expression[br /] S=x+x[sup]2[/sup]+x[sup]3[/sup]+…+x[sup]n[/sup]


  • S := 0;
  • begin
  • x, S, p : real;
  • until i>N;
  • readln(n);
  • write('Enter x=');
  • if n<1 then write('Error')
  • write('Enter N= ');
  • repeat
  • i := 1;
  • p := p*x;
  • S := S + p;
  • begin
  • readln(x);
  • end.
  • i : integer;
  • p := 1;
  • i := i+1;
  • var n : integer;
  • else
  • write('S= ', S)
  • end