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[sup]-1[/sup]-2.x[sup]-2[/sup]+3.x[sup]-3[/sup]-4.x[sup]-4[/sup]+…+ n.x[sup]-n [/sup]


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