C# Course
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Assignment #2

3 posters

Go down

Assignment #2 Empty Assignment #2

Post  Admin Fri Sep 07, 2007 7:15 am

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:

Assignment #2 Number10

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

Admin
Admin

Posts : 9
Join date : 2007-09-05

https://c-course.board-directory.net

Back to top Go down

Assignment #2 Empty Re: Assignment #2

Post  AHMED Fri Sep 07, 2007 3:46 pm

و ديه تتعمل ازاي ديه يا عم


ايه الوهم ده

صباح عدم التدرج في الأفكار

طيب لما اصحى بقى اشتغل فيها

يلاهوويييييييييييي

Crying or Very sad Crying or Very sad Crying or Very sad Crying or Very sad

AHMED

Posts : 3
Join date : 2007-09-07

Back to top Go down

Assignment #2 Empty Re: Assignment #2

Post  Admin Fri Sep 07, 2007 3:53 pm

معلش يا احمد حاول فيه واتعب شوية

وبعدين البرنامج ال احن اخدناه الحصة ال فاتت فى حاجات كتير ممكن تساعدك فى البرنامج ده

الكود بتاع البرنامج ال اتشرح فى الحصة اهه:

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();
        }
    }
}

أى سؤال او اى حاجة عايز تعرفها كلمنى عالتليفون او حطه هنا او دور فى جوجل

ربنا معاك Very Happy

Admin
Admin

Posts : 9
Join date : 2007-09-05

https://c-course.board-directory.net

Back to top Go down

Assignment #2 Empty ............

Post  Eng.Ahmed Sat Sep 08, 2007 12:54 pm

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... Sad

Eng.Ahmed

Posts : 3
Join date : 2007-09-08
Age : 39
Location : Cairo, Egypt

http://www.sat.itgo.com

Back to top Go down

Assignment #2 Empty Re: Assignment #2

Post  Admin Sat Sep 08, 2007 2:00 pm

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++;
}

Admin
Admin

Posts : 9
Join date : 2007-09-05

https://c-course.board-directory.net

Back to top Go down

Assignment #2 Empty Re: Assignment #2

Post  AHMED Sat Sep 08, 2007 7:31 pm

هو البتاع اشتغل عندي شيئا ما

مش عارف

بس ده اللي وصلتله

اخر حاجة

سلمتها لك دلوقت في ايميل

انا قلت بس الحق الميعاد

وبكره قبل الكورس ححاول اشتغل فيها تاني ان شاء الله

check your gmail

AHMED

Posts : 3
Join date : 2007-09-07

Back to top Go down

Assignment #2 Empty Re: Assignment #2

Post  Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum