Jump to content

Php'de Kapsamlı Hesap Makinesi


Recommended Posts

[code]
<?php
if(isset($_GET["islem"]))
{
$sayi1 = $_GET["sayi1"];
$sayi2 = $_GET["sayi2"];
$islem = $_GET["islem"];
$sonuc = 0;
switch ($islem)
{
case "topla":
$sonuc = $sayi1+$sayi2;
break;
case "cikar":
$sonuc = $sayi1-$sayi2;
break;
case "carp":
$sonuc = $sayi1*$sayi2;
break;
case "bol":
$sonuc = $sayi1/$sayi2;
}
}
?>
<html>
<head>
<title>Hesap Makinesi</title>
</head>
<body>
<?php
if(isset($_GET["islem"])){
?>
<h1>Sonuç:<?php echo $sonuc; ?></h1>
<?php
}
?>
<form action="" method="get" >
<fieldset style="display:inline;">
<legend>Hesap Makinesi</legend>
Sayı1:<br/><input type="text" name="sayi1" id="sayi1" value="" /><br/>
Sayı2:<br/><input type="text" name="sayi2" id="sayi2" value="" /><br/>
<select name="islem">
<option value="topla">Topla</option>
<option value="cikar">Çıkar</option>
<option value="carp">Çarp</option>
<option value="bol">Böl</option>
</select><br/>
<input type="submit" value="Hesapla" />
</fieldset>
</form>



</body>
</html>
[/code]

Ben bu hesap makinesine "cos,sin gibi hesaplamaları eklemek istiyorum..! "
Ek olarak bunların dışında şöyle yapmam lazım girilen 1.sayının %30 unu 2.sayının ise %70 ini alacagım ve çıkan sonucu toplatacağım.
Yardımcı olabilecek arkadaş varmı ?
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...