Sunday, November 14, 2010

subalgoritm task .....

.




  my task : 1-3 (use procedure of subalgoritm)

1)


                   n         2
f(x) = 2x + 3y + 4y
use procedure of subalgoritm


2) create algorithms to display the number pacal



3) create algorithms to display the prime numbers 
      prime numbers (2, 3, 5, 7, 11, 13, 17, 19, 23 ,29, . . .. )





 example with if - then
question :
find out the y-value from given x-value of :


                       3          2
f (x) = 3x - 5x + 2x -6 

answer : 
var
   x,f : integer ;

begin 
   write ('insert the value of x : ') ;
   readln (x) ;
   if x > 0 then
   begin
     f : 3*x*x*x - 5*x*x + 2* - 6
     readln ;
   end
   else
     writeln (' x value mustn't be 0');
   end
end


example for "procedure"
3 x 5 = 3 x 3 x 3 x 3 x 3


proc . multiple (x , y , result )
  a + x = a
  b + 1 = b
    while b < y do
       a + x = a
       b + 1 = b
    end while
end proc
































































Wednesday, November 10, 2010

can u solve it ?



find out y-valuefrom give x,y,n of 


                     n         2
f(x) = 2x + 3y + 4y