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.