Write a program which takes a string as input and finds the number of occurrence of “i”.
Problem number : 2
Write a program which takes a string as input and finds the number of occurrence of “i”.
Sample Input:
University
Sample Output:
2
Solution For this problem :
<?php
//echo "Hello World !";
echo "<br/>";
$name="university";
$count=0;
for($i=0;$i<strlen($name);$i++)
{
if($name[$i]=="i")
{
$count++;
}
}
echo $count;
echo "<br/>";
echo "<br/>";
?>
Sample Input:
University
Sample Output:
2
University
Sample Output:
2
মন্তব্যসমূহ
একটি মন্তব্য পোস্ট করুন