Lesson 3 of 23

scanf() ने Input वाचणे

8 min 20 XP

scanf() वापरकर्त्याकडून values वाचते. Variable च्या नावापुढे & (address-of) लावा म्हणजे scanf त्यात लिहू शकेल. 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.