Lesson 4 of 23

Operators மற்றும் Type CastingOperators and Type Casting

9 min 20 XP

இரண்டு int-களை வகுத்தால் (/) தசமப் பகுதி நீக்கப்படும்: 7 / 2 = 3. % மீதியைத் தரும்: 7 % 2 = 1. தசம விடை வேண்டுமெனில் (double) என்று cast செய்யுங்கள்.

Dividing two ints drops the decimal part: 7 / 2 is 3. % gives the remainder: 7 % 2 is 1. Cast with (double) when you need a decimal answer.

Example: edit me and press Run

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

++i முதலில் கூட்டி பிறகு மதிப்பைத் தரும்; i++ முதலில் பழைய மதிப்பைத் தந்து பிறகு கூட்டும். இது C interview-களில் மிகப் பிரபலமான கேள்வி.

++i increments first and then gives the value; i++ gives the old value and then increments. A very popular C interview question.

Challenge

+20 XP

மொத்த வினாடிகளைப் (seconds) படித்து மணி:நிமிடம்:வினாடி என்று print செய்யுங்கள். Input: 3725 → Output: 1:2:5

Read a number of seconds and print it as hours:minutes:seconds. Input: 3725 → Output: 1:2:5

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