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


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