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:
Write own a program that calculates the value of the function for N>1 and random x:[br /] y = x + x[sup]2[/sup]/2+x[sup]3[/sup]/3+ ... + x[sup]n[/sup]/n


  • cout<<"Enter n=";
  • write('Enter n= ');
  • cout<<"y="<<y;
  • end. #include<iostream.h>
  • Q := 1;
  • P=x; Q=1;
  • P=P*x;
  • readln(x);
  • write('y= ', y)
  • {
  • Q++;
  • begin
  • if (n<1) cout<<"Error";
  • begin
  • double x, y, P, Q;
  • y := 0;
  • end
  • P, Q : real;
  • y := y + P/Q;
  • void main()
  • write('Enter x= ');
  • else {
  • var x, y : real;
  • if n<1 then write('Eror')
  • readln(n);
  • cout<<"Enter x=";
  • P := x;
  • end;
  • begin
  • Q := Q + 1
  • cin>>n;
  • else
  • y=y+(double)P/Q;
  • }
  • while Q<=n do
  • while (Q<=n){
  • P := P * x;
  • y=0;
  • }
  • int n;
  • n : integer;
  • cin>>x;
  • }