Code Blocks

Bite sized, Actionable, Tips, Tricks and API References

Code Blocks


 
Here is the small info box. You can add any notes or some highlighted informations.
 
// Create a function to check if a number is even function isEven(num) { return num % 2 === 0; } // Create a function to check if a number is odd function isOdd(num) { return num % 2 !== 0; } // Create a function to check if a number is prime function isPrime(num) { if (num < 2) return false; for (let i = 2; i < num; i++) { if (num % i === 0) return false; } return true; } // Create a function to check if a number is divisible by another number function isDivisible(num, divisor) { return num % divisor === 0; } // Create a function to check if a number is a perfect square function isPerfectSquare(num) { for (let i = 1; i <= num; i++) { if (i * i === num) return true; } return false; } // Create a function to check if a number is a perfect cube function isPerfectCube(num) { for (let i = 1; i <= num; i++) { if (i * i * i === num) return true; } return false; } // Create a function to check if a number is a palindrome function isPalindrome(num) { let reversed = 0; let original = num; while (num > 0) { reversed = (reversed * 10) + (num % 10); num = Math.floor(num / 10); } return reversed === original; } // Helper function to calculate the sum of squares of a number's digits function sumOfSquares(num) { let sum = 0; while (num > 0) { let digit = num % 10; sum += digit * digit; num = Math.floor(num / 10); } return sum; }
 
 
 
 
using System; namespace AdvancedCSharp { class Program { static void Main(string[] args) { // Create a list of integers List<int> numbers = new List<int> { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; // Use LINQ to find the even numbers var evenNumbers = numbers.Where(n => n % 2 == 0); // Print out the even numbers Console.WriteLine("Even numbers:"); foreach (var number in evenNumbers) { Console.WriteLine(number); } // Use LINQ to find the odd numbers var oddNumbers = numbers.Where(n => n % 2 != 0); Console.ReadLine(); } } }
 

FAQs

What is the purpose of this documentation template?
This documentation template is designed to provide a comprehensive guide to help users understand and use the product. It includes detailed instructions, screenshots, and other helpful information.
How do I access the documentation template?
Duplicate this template in Notion and Copy the code in Bullet Dashboard. You should be able to use this template.
Can I use this template in any languages languages?
Yes, you can use any language for this template.