Kamis, 08 Desember 2011

SOAL FUNCTION(1)


Soal  1 :
Ada 2 parameter (x,y), hitung angka ganjil dari Ganjil (X,Y), contoh :
Ganjil(2,10)         -> hasil : 3 5 7 9
Ganjil(10,5)         -> hasil : ERROR
Buatlah Flowchart Algoritma dan Program VBScript HTML 

FLOWCHART

PROGRAM VBScript HTML
<html>
    <head>
        <script language="VBS">
            function ganjil(a,b)
                dim hitung
                hitung = ""
                for p=a to b
                    if p mod 2 = 1 then
                        hitung = hitung & " " & p
                    end if
                next

                ganjil = hitung
            end function
        </script>   
    </head>
    <body>
        <script language="VBS">
            x=cint(inputbox("masukkan X"))
            y=cint(inputbox("masukkan Y"))
            If x<y then
                hasil = ganjil(x,y)               
            else
                hasil = "ERROR"
            end if
           
            document.write hasil

        </script>
    </body>
</html> 



Soal 2 :
Ada 4 parameter (a,b,c,d), hitung pekalian dari Perkalian(a,b,c,d) = Carimax(a,b,c,d) * Carimin(a,b,c,d), contoh :
Carimax(4,5,6,7)               -> hasil : 7
Carimin(4,5,6,7)                -> hasil : 4
Perkalian(4,5,6,7)              -> hasil : 7 * 4 = 28
Buatlah Flowchart Algoritma dan Program VBScript HTML

FLOWCHART


PROGRAM VBScript HTML

<html>
    <head>
        <script language="VBS">
            function carimax(h,i,j,k)
                dim hitung
                dim ab
                dim abc
                dim abcd
               
                if h>i then
                    ab = h
                else
                    ab = i
                end if
               
                if ab>j then
                    abc = ab
                else
                    abc = j
                end if
               
                if abc>k then
                    abcd = abc
                else
                    abcd = k
                end if
               
                hitung = abcd
                carimax = hitung
            end function
        </script>
        <script language="VBS">
            function carimin(h,i,j,k)
                dim hitung
                dim ab
                dim abc
                dim abcd
               
                if h<i then
                    ab = h
                else
                    ab = i
                end if
               
                if ab<j then
                    abc = ab
                else
                    abc = j
                end if
               
                if abc<k then
                    abcd = abc
                else
                    abcd = k
                end if
               
                hitung = abcd
                carimin = hitung
            end function
        </script>   
        <script language="VBS">
            function perkalian(p,q,r,s)
                dim hitung
               
                hitung = carimax(p,q,r,s)*carimin(p,q,r,s)
               
                perkalian = hitung
            end function
        </script>       
    </head>
    <body>
        <script language="VBS">
            a=cint(inputbox("masukkan A"))
            b=cint(inputbox("masukkan B"))
            c=cint(inputbox("masukkan C"))
            d=cint(inputbox("masukkan D"))
           
            nilmin = carimin(a,b,c,d)
            nilmax = carimax(a,b,c,d)
            hasil = perkalian(a,b,c,d)               
           
            document.write "Nilai Min = " & nilmin & "</br>"
            document.write "Nilai Max = " & nilmax & "</br>"
            document.write "Hasil perkalian = " & hasil

        </script>
    </body>
</html>



 




2 komentar:

Unknown mengatakan...

wah, langsung di respon, terimakasih banyak

Vince Kao
upgad.org

Blogger mengatakan...

This is how my colleague Wesley Virgin's adventure launches with this shocking and controversial VIDEO.

Wesley was in the army-and soon after leaving-he found hidden, "MIND CONTROL" secrets that the CIA and others used to get whatever they want.

These are the same SECRETS tons of famous people (notably those who "come out of nowhere") and top business people used to become rich and famous.

You probably know that you use only 10% of your brain.

That's mostly because the majority of your brain's power is UNTAPPED.

Maybe this expression has even taken place IN YOUR own head... as it did in my good friend Wesley Virgin's head around 7 years ago, while riding an unlicensed, beat-up garbage bucket of a car with a suspended license and $3.20 in his pocket.

"I'm so frustrated with going through life check to check! When will I finally succeed?"

You've taken part in those thoughts, ain't it right?

Your very own success story is going to happen. You just need to take a leap of faith in YOURSELF.

CLICK HERE TO LEARN WESLEY'S METHOD

Posting Komentar

Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | GreenGeeks Review