درس 33
- اكتبي برنامج احسبي فيه كم مرة تكرر عنصر من عناصر المصفوفة.
int [] x=new int [5] {12,12,3,12,4};
for( int i=0; i<x.length; i++ )
- اطلب من المستخدم يدخل حجم المصفوفة ، وانشئي المصفوفة بناء على هاد الحجم ،
خلي اليوزر يعبي عناصر المصفوفة ،
وكمان اطلبي من اليوزر يحكيلك ايش العنصر اللي حابب يعرف كم عدده.
OR
1- Console.WriteLine("Enter the size of array");
int size=Int32.Parse(ReadLine());
int x= new int [size] ;
2- for(int i=0; i <x.length ;i++)
{
Console.WriteLine("Enter the {0} number",i+1);
x[i]=Int32.Parse(Console.ReadLine()):
}
3-
Console.WriteLine("Enter the number repeat");
int a=Int32.Parse(ReadLine());
int counter=0;
for(int i=0; i <x.length ;i++)
{
if (a== x[i])
counter++;
}
Console.WriteLine(counter);
-اعملي ران كونترول مع اف5
No comments:
Post a Comment