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.