Assignment #2
3 posters
C# Course :: About Course :: Assignments
Page 1 of 1
Assignment #2
You are required to make a program that counts the no of repitition of a certain number in an array of numbers
it should look something like this:
Hints:
1) Use one array of type int
2) Use 2 for loops, the first one to fill the array with its contents and the second one to count the no of repitition of the number specified
3) Use an if statement in the second for loop
Deadline for assignment delivery is Saturday 8/9
Thank you
it should look something like this:
Hints:
1) Use one array of type int
2) Use 2 for loops, the first one to fill the array with its contents and the second one to count the no of repitition of the number specified
3) Use an if statement in the second for loop
Deadline for assignment delivery is Saturday 8/9
Thank you
Last edited by on Fri Sep 07, 2007 4:00 pm; edited 1 time in total
Re: Assignment #2
و ديه تتعمل ازاي ديه يا عم
ايه الوهم ده
صباح عدم التدرج في الأفكار
طيب لما اصحى بقى اشتغل فيها
يلاهوويييييييييييي
ايه الوهم ده
صباح عدم التدرج في الأفكار
طيب لما اصحى بقى اشتغل فيها
يلاهوويييييييييييي
AHMED- Posts : 3
Join date : 2007-09-07
Re: Assignment #2
معلش يا احمد حاول فيه واتعب شوية
وبعدين البرنامج ال احن اخدناه الحصة ال فاتت فى حاجات كتير ممكن تساعدك فى البرنامج ده
الكود بتاع البرنامج ال اتشرح فى الحصة اهه:
أى سؤال او اى حاجة عايز تعرفها كلمنى عالتليفون او حطه هنا او دور فى جوجل
ربنا معاك
وبعدين البرنامج ال احن اخدناه الحصة ال فاتت فى حاجات كتير ممكن تساعدك فى البرنامج ده
الكود بتاع البرنامج ال اتشرح فى الحصة اهه:
- Code:
using System;
using System.Collections.Generic;
using System.Text;
namespace names
{
class Program
{
static void Main(string[] args)
{
//the next part creates new arrays of size specified by the user
Console.WriteLine("Enter no. of record");
string s=Console.ReadLine();
int NoOfRec=Convert.ToInt32(s);
string[] names=new string[NoOfRec];
int[] grades=new int[NoOfRec];
//the following for loop is used to fill arrays names and grades
for (int i = 0; i < names.Length; i++)
{
Console.WriteLine("Enter name");
string TempName=Console.ReadLine();
Console.WriteLine("Enter grade");
string TempGradeString=Console.ReadLine();
int TempGrade = Convert.ToInt32(TempGradeString);
names[i] = TempName;
grades[i] = TempGrade;
}
//the following for loop prints out thw contents of the arrays
for(int i=0; i<names.Length; i++)
{
Console.WriteLine("Name "+i+" is:"+names[i]+"\tGrade is"+grades[i]);
}
Console.ReadLine();
}
}
}
أى سؤال او اى حاجة عايز تعرفها كلمنى عالتليفون او حطه هنا او دور فى جوجل
ربنا معاك
............
ana 7awelt akamel 3ala el program beta3 el names da 3ala asas enno ye3edely kam marra etkarrar grade mo3ayan bas fe 7etta mesh 3aref akemlha feh...
Re: Assignment #2
tayyeb ana hasa3edko shewaya, da el code el beye3raf kam marra el rakam etkarrar
- Code:
int repeat = 0; //repeat is the integer that will contain the no of repitition
for (int i = 0; i < numbers.Length; i++)
{
if (numbers[i] == y) //y is the number to check for its repitition
repeat++;
}
Re: Assignment #2
هو البتاع اشتغل عندي شيئا ما
مش عارف
بس ده اللي وصلتله
اخر حاجة
سلمتها لك دلوقت في ايميل
انا قلت بس الحق الميعاد
وبكره قبل الكورس ححاول اشتغل فيها تاني ان شاء الله
check your gmail
مش عارف
بس ده اللي وصلتله
اخر حاجة
سلمتها لك دلوقت في ايميل
انا قلت بس الحق الميعاد
وبكره قبل الكورس ححاول اشتغل فيها تاني ان شاء الله
check your gmail
AHMED- Posts : 3
Join date : 2007-09-07
C# Course :: About Course :: Assignments
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|