Lesson 7 of 24

Functions, Default Arguments, Overloading

9 min 25 XP

Parameters വ്യത്യസ്തമാണെങ്കിൽ C++-ൽ പല functions-ന് ഒരേ പേര് ഉപയോഗിക്കാം (overloading). Default arguments അവസാന parameters ഐച്ഛികമാക്കുന്നു.

Example: edit me and press Run

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

Challenge

+25 XP

bool isPrime(int n) എഴുതൂ. main()-ൽ n വായിച്ച് 2 മുതൽ n വരെയുള്ള ഓരോ prime-ഉം spaces കൊണ്ട് വേർതിരിച്ച് print ചെയ്യൂ. Input: 20 → Output: 2 3 5 7 11 13 17 19

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