UYGULAMA

html>
<head>
<meta charset="UTF-8">
<title>UYGULAMA</title>
<img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" data-wp-preserve="%3Cstyle%3E%0D%0A.baslik%7B%0D%0A%09color%3Ablue%3B%0D%0A%09font-weight%3Abold%3B%0D%0A%09%20text-align%3Acenter%3B%0D%0A%7D%0D%0A.sut1%7B%0D%0A%09text-align%3Aright%3B%0D%0A%09color%3Ared%3B%0D%0A%09font-weight%3Abold%3B%09%0D%0A%7D%0D%0A%0D%0A%3C%2Fstyle%3E" data-mce-resize="false" data-mce-placeholder="1" class="mce-object" width="20" height="20" alt="<style>" title="<style>" />
</head>
<body>
<?php
function getir($disim)
{
	if(isset($_POST[$disim]))
		return $_POST[$disim];
	else
		return "";
}
function kontrolet($deger)
{
	if($deger!=""&&is_numeric($deger))
		 return true;
       else
		   return false;
	 }
	$secim=getir("secim");
    $sayi=getir("tsayi");
	$sonuc=0;
if(count($_POST)>0&&(!is_numeric($secim))&&kontrolet($sayi)&&isset($secim)&&!(is_null($secim)))
{
  function fibonacci($sayi){ $sonuc=1;
    $s1=0;
      $s2=1;
	while(true)
	{
	    if($sonuc>=$sayi)
		{
		      if($sonuc==$sayi)
                 return $sayi." fibonacci sayisidir";
               else 
                return $sayi." fibonacci sayisi değildir";        			 
		}
		$sonuc=$s1+$s2;
		$s1=$s2;
		$s2=$sonuc;
	}	
   }
function usal($sayi,$ussu){
	$sonuc=1;
	for($i=1;$i<=$ussu;$i++)
		$sonuc*=$sayi;
	echo $sonuc;
}
function karekok($sayi){
	for($i=1;$i<$sayi;$i++)
	{
		if($i*$i==$sayi)
		{
			return $i;
			
		}
	}
	
}
  function f($sayi){
	  $sonuc=1;
	   for($i=1;$i<=$sayi;$i++)
		 $sonuc*=$i;
	     return $sonuc;
    }
switch($secim){
	case "fibonacci":
	$sonuc=fibonacci($sayi);
	break;
	  case "faktoriyel":
	  $sonuc=f($sayi);
	  break;
	     case "karekok":
		 $sonuc=karekok($sayi);
		 break;
  	}
?>
<table border="1" cellspacing="0" cellpadding="0">
<tr>
<td colspan=2 class="baslik">SAYINI ÖZELLİKLERİ</td>
</tr>
<tr>
<td class="sut1">Secim</td>
<td><?php echo $secim;?></td>
</tr>
<tr>
<td class="sut1">Sonuc:</td>
<td><?php echo $sonuc;?></td>
</tr>
<tr>
<td colspan="2" class="baslik"><a href="">Ana Sayfaya Dön</a></td>
</tr>
</table>
<?php
 }
 else
 {
	 ?>
<form name="uyg" method="post" action="">
<table border="1" cellspacing="0" cellpadding="0" >
<tr>
<td colspan=2 class="baslik">SAYININ ÖZELLİKLERİ</td>
</tr>
<tr>
<td class="sut1">Bir sayi Giriniz:</td><td><input type="text" name="tsayi" id="tsayi" value=""/></td>
</tr>
<tr>
<td class="sut1">Secim Yapınız:</td>
<td>
<select name="secim" >
<option value="0">Seciniz</option>
<option value="fibonacci">Fibonacci</option>
<option value="karekok">Karekök</option>
<option value="faktoriyel">Faktöriyel</option>
<select>
</td>
</tr>
<tr>
<td class="baslik"colspan="2"><input type="submit" value="gönder" name="bgonder" id="bgonder"/>     <input type="reset" name="bsil" id="bsil"/> </td>
</tr>
</table>
</form>
 <?php
 }
 ?>
</body>
</html>

 

Bir cevap yazın

E-posta hesabınız yayımlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir