C# 0 The Complete Reference


PART I C h a p t e r   6



Download 4,07 Mb.
Pdf ko'rish
bet185/1096
Sana23.01.2022
Hajmi4,07 Mb.
#402171
1   ...   181   182   183   184   185   186   187   188   ...   1096
Bog'liq
C-Sharp 3 The Complete Reference Herbert Schildt


PART I

C h a p t e r   6 :  

I n t r o d u c i n g   C l a s s e s   a n d   O b j e c t s  

123


PART IPART I

      else Console.WriteLine(i + " is not prime.");

  }

}

Here is the output produced by the program:



2 is prime.

3 is prime.

4 is not prime.

5 is prime.

6 is not prime.

7 is prime.

8 is not prime.

9 is not prime.

In the program, 

IsPrime( )

 is called nine times, and each time a different value is passed. 

Let’s look at this process closely. First, notice how 

IsPrime( )

 is called. The argument is 

specified between the parentheses. When 

IsPrime( )

 is called the first time, it is passed value 

1. Thus, when 

IsPrime( )

 begins executing, the parameter 



x

 receives the value 1. In the 

second call, 2 is the argument, and 

x

 then has the value 2. In the third call, the argument 

is 3, which is the value that 

x

 receives, and so on. The point is that the value passed as an 

argument when 

IsPrime( )

 is called is the value received by its parameter, 



x

.

A method can have more than one parameter. Simply declare each parameter, separating 



one from the next with a comma. For example, here the 

ChkNum

 class is expanded by 

adding a method called 


Download 4,07 Mb.

Do'stlaringiz bilan baham:
1   ...   181   182   183   184   185   186   187   188   ...   1096




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish