Lesson 14 of 23

Functions

10 min 25 XP

Function ಎಂದರೆ return type, ಹೆಸರು ಮತ್ತು parameters ಇರುವ ಹೆಸರಿನ ಕೋಡ್ block. ಅದನ್ನು main() ಕೆಳಗೆ define ಮಾಡಿದರೆ, main() ಮೇಲೆ ಒಂದು prototype declare ಮಾಡಿ.

Example: edit me and press Run

Output Loading C (first time takes a few seconds)
Press Run to see the result here.

C arguments ಅನ್ನು value ಮೂಲಕ ಕಳುಹಿಸುತ್ತದೆ: function ಒಳಗೆ parameter ಬದಲಿಸಿದರೆ caller ನ variable ಬದಲಾಗದು. ಅದನ್ನು ಬದಲಿಸಲು pointers ಬೇಕು (ಮುಂದಿನ module).

Example: edit me and press Run

Output Loading C (first time takes a few seconds)
Press Run to see the result here.

Challenge

+25 XP

Euclid ವಿಧಾನದಲ್ಲಿ int gcd(int a, int b) function ಬರೆಯಿರಿ. main() ನಲ್ಲಿ a ಮತ್ತು b ಓದಿ GCD ಮತ್ತು LCM print ಮಾಡಿ. Input: 12 18 Output: GCD: 6 LCM: 36

Output Loading C (first time takes a few seconds)
Press Run to see the result here.