C# 0 The Complete Reference



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

LeastComFactor( )

 is called, the arguments are also separated by 

commas. The output from the program is shown here:

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.

Least common factor for 7 and 8 is 1

Least common factor for 100 and 8 is 2

Least common factor for 100 and 75 is 5

When using multiple parameters, each parameter specifies its own type, which can 

differ from the others. For example, this is perfectly valid:

int MyMeth(int a, double b, float c) {

 // ...


www.freepdf-books.com


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  

125


PART IPART I

Add a Parameterized Method to Building

You can use a parameterized method to add a new feature to the 



Building

 class: the ability 

to compute the maximum number of occupants for a building assuming that each occupant 

must have a certain minimal space. This new method is called 



MaxOccupant( )

. It is shown 

here:

// Return the maximum number of occupants if each



// is to have at least the specified minimum area.

public int MaxOccupant(int minArea) {

  return Area / minArea;

}

When




Download 4,07 Mb.

Do'stlaringiz bilan baham:
1   ...   183   184   185   186   187   188   189   190   ...   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