Lesson 3 of 23

scanf() ಮೂಲಕ Input ಓದುವುದು

8 min 20 XP

scanf() ಬಳಕೆದಾರರಿಂದ values ಓದುತ್ತದೆ. scanf ಅದರಲ್ಲಿ ಬರೆಯುವಂತೆ variable ಹೆಸರಿನ ಮುಂದೆ & (address-of) ಹಾಕಿ. double ಓದಲು %lf ಬಳಸಿ.

Example: edit me and press Run

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

Example: edit me and press Run

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

String (char array) ಓದಲು & ಬೇಕಿಲ್ಲ, ಏಕೆಂದರೆ array ಯ ಹೆಸರೇ ಒಂದು address. %s ಒಂದೇ ಪದವನ್ನು, space ವರೆಗೆ ಓದುತ್ತದೆ.

Challenge

+20 XP

ವೃತ್ತದ ತ್ರಿಜ್ಯ (double) ಓದಿ ಅದರ ವಿಸ್ತೀರ್ಣವನ್ನು 2 ದಶಮಾಂಶ ಸ್ಥಾನಗಳೊಂದಿಗೆ print ಮಾಡಿ. PI = 3.14159 ಬಳಸಿ. Input: 2 → Output: 12.57

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