The Wayback Machine - https://web.archive.org/web/20240914123455/https://www.geeksforgeeks.org/coding-challenge-for-beginners/
Open In App

Coding Challenge for Beginners | Coding Practice Challenges

Last Updated : 29 Jan, 2024
Summarize
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

Here’s a simple coding challenge suitable for beginners. This challenge involves writing a function in a programming language of your choice.

Table of Content

Challenge 1: Print Numbers from 1 to 10

Javascript




for (let i = 1; i <= 10; i++) {
    console.log(i);
}


Challenge 2: Print Odd Numbers Less Than 100

Javascript




for (let i = 1; i < 100; i += 2) {
   console.log(i);
}


Challenge 3: Print Multiplication Table with 7

Javascript




for (let i = 1; i <= 10; i++) {
  console.log(`7 * ${i} = ${7 * i}`);
}


Challenge 4: Print All Multiplication Tables (1 to 10)

Javascript




for (let i = 1; i <= 10; i++) {
  for (let j = 1; j <= 10; j++) {
    console.log(`${i} * ${j} = ${i * j}`);
  }
}


Challenge 5: Calculate Sum of Numbers from 1 to 10

Javascript




let sum = 0;
for (let i = 1; i <= 10; i++) {
  sum += i;
}
console.log(sum);


Challenge 6: Calculate 10!

Javascript




function factorial(n) {
  if (n === 0 || n === 1) return 1;
  return n * factorial(n - 1);
}
  
console.log(factorial(10));


Challenge 7: Sum of Odd Numbers (10 to 30)

Javascript




let sum = 0;
for (let i = 11; i < 30; i += 2) {
  sum += i;
}
console.log(sum);


Challenge 8: Celsius to Fahrenheit Conversion

Javascript




function celsiusToFahrenheit(celsius) {
  return (celsius * 9/5) + 32;
}
  
console.log(celsiusToFahrenheit(30));


Challenge 9: Fahrenheit to Celsius Conversion

Javascript




function fahrenheitToCelsius(fahrenheit) {
  return (fahrenheit - 32) * 5/9;
}
  
console.log(fahrenheitToCelsius(86));


Challenge 10: Sum of Numbers in an Array

Javascript




let numbers = [1, 2, 3, 4, 5];
let sum = numbers.reduce((acc, curr) => acc + curr, 0);
console.log(sum);


Challenge 11: Average of Numbers in an Array

Javascript




let numbers = [1, 2, 3, 4, 5];
let average = numbers.reduce((acc, curr) => acc + curr, 0) / numbers.length;
console.log(average);


Challenge 12: Positive Numbers in an Array (Solution 1)

Javascript




function positiveNumbers(arr) {
  return arr.filter(num => num > 0);
}
  
console.log(positiveNumbers([-1, 2, -3, 4, -5]));


Challenge 12: Positive Numbers in an Array (Solution 2)

Javascript




function positiveNumbers(arr) {
  let result = [];
  for (let num of arr) {
    if (num > 0) {
      result.push(num);
    }
  }
  return result;
}
  
console.log(positiveNumbers([-1, 2, -3, 4, -5]));


Challenge 12: Positive Numbers in an Array (Solution 3)

Javascript




function positiveNumbers(arr) {
  let result = [];
  arr.forEach(num => {
    if (num > 0) {
      result.push(num);
    }
  });
  return result;
}
  
console.log(positiveNumbers([-12, 22, -3, 41, -15]));


Challenge 13: Maximum number in an array

Javascript




let numbers = [5, 8, 3, 12, 7];
let max = Math.max(...numbers);
console.log(max);


Challenge 14: First 10 Fibonacci numbers without recursion

Javascript




let fib = [0, 1];
for (let i = 2; i < 10; i++) {
    fib[i] = fib[i - 1] + fib[i - 2];
}
console.log(fib);


Challenge 15: nth Fibonacci number using recursion

Javascript




function fibonacci(n) {
    if (n <= 1) {
        return n;
    }
    return fibonacci(n - 1) + fibonacci(n - 2);
}
console.log(fibonacci(5));


Challenge 16: Check if a number is prime

Javascript




function isPrime(num) {
    if (num <= 1) return false;
    for (let i = 2; i <= Math.sqrt(num); i++) {
        if (num % i === 0) return false;
    }
    return true;
}
console.log(isPrime(11));


Challenge 17: Sum of digits of a positive integer

Javascript




function sumOfDigits(num) {
    let sum = 0;
    while (num > 0) {
        sum += num % 10;
        num = Math.floor(num / 10);
    }
    console.log(sum);
}
sumOfDigits(123);


Challenge 18: First 100 prime numbers

Javascript




function generatePrimes(count) {
    let primes = [];
    for (let i = 2; primes.length < count; i++) {
        if (isPrime(i)) {
            primes.push(i);
        }
    }
    console.log(primes);
}
generatePrimes(100);


Challenge 19: First “nPrimes” prime numbers greater than “startAt”

Javascript




function generatePrimes(nPrimes, startAt) {
    let primes = [];
    let num = startAt + 1;
    while (primes.length < nPrimes) {
        if (isPrime(num)) {
            primes.push(num);
        }
        num++;
    }
    console.log(primes);
}
generatePrimes(5, 10);


Challenge 20: Rotate an array to the left 1 position

Javascript




let arr = [1, 2, 3, 4, 5];
let temp = arr.shift();
arr.push(temp);
console.log(arr);


Challenge 21: Rotate an array to the right 1 position

Javascript




let arr = [1, 2, 3, 4, 5];
let temp = arr.pop();
arr.unshift(temp);
console.log(arr);


Challenge 22: Reverse an array

Javascript




let arr = [1, 2, 3, 4, 5];
let reversed = arr.reverse();
console.log(reversed);


Challenge 23: Reverse a string

Javascript




let str = "Hello, Geeks!";
let reversed = str.split('').reverse().join('');
console.log(reversed);


Challenge 24: Merge two arrays

Javascript




let arr1 = [1, 2, 3];
let arr2 = [4, 5, 6];
let merged = arr1.concat(arr2);
console.log(merged);


Challenge 25: Elements in the first or second array but not both

Javascript




let arr1 = [1, 2, 3, 4];
let arr2 = [3, 4, 5, 6];
let result = arr1.filter(num => !arr2.includes(num)).concat(arr2.filter(num => !arr1.includes(num)));
console.log(result);


Challenge 26: Elements in the first array but not in the second

Javascript




let arr1 = [1, 2, 3, 4];
let arr2 = [3, 4, 5, 6];
let result = arr1.filter(num => !arr2.includes(num));
console.log(result);


Challenge 27: Distinct elements in an array(Solution 1)

Javascript




function getDistinctElements1(arr) {
    return Array.from(new Set(arr));
}
  
let inputArray = [1, 2, 2, 3, 4, 4, 5];
let distinctArray1 = getDistinctElements1(inputArray);
console.log(distinctArray1);


Challenge 27: Distinct elements in an array(Solution 2)

Javascript




function getDistinctElements2(arr) {
    return arr.filter((value, index, self) => self.indexOf(value) === index);
}
  
let inputArray = [1, 2, 2, 3, 4, 4, 5];
let distinctArray2 = getDistinctElements2(inputArray);
console.log(distinctArray2);


Challenge 28: Sum of first 100 prime numbers

Javascript




function sumOfPrimes(count) {
    let primes = [];
    let sum = 0;
    for (let i = 2; primes.length < count; i++) {
        if (isPrime(i)) {
            primes.push(i);
            sum += i;
        }
    }
    console.log(sum);
}
sumOfPrimes(100);


Challenge 29: Distance between the first 100 prime numbers

Javascript




function primeDistance(count) {
    let primes = [];
    for (let i = 2; primes.length < count; i++) {
        if (isPrime(i)) {
            primes.push(i);
        }
    }
    let distance = [];
    for (let i = 1; i < primes.length; i++) {
        distance.push(primes[i] - primes[i - 1]);
    }
    console.log(distance);
}
primeDistance(100);


Challenge 30: Add two positive numbers of indefinite size as strings(Solution 1)

Javascript




function addStrings1(num1, num2) {
    let result = BigInt(num1) + BigInt(num2);
    return result.toString();
}
  
  
let sum1 = addStrings1("12345678901234567890", "98765432109876543210");
console.log(sum1);


Challenge 30: Add two positive numbers of indefinite size as strings(Solution 2)

Javascript




function addStrings2(num1, num2) {
    let maxLength = Math.max(num1.length, num2.length);
    num1 = num1.padStart(maxLength, '0');
    num2 = num2.padStart(maxLength, '0');
  
    let carry = 0;
    let result = '';
  
    for (let i = maxLength - 1; i >= 0; i--) {
        let digitSum = parseInt(num1[i]) + parseInt(num2[i]) + carry;
        carry = Math.floor(digitSum / 10);
        result = (digitSum % 10).toString() + result;
    }
  
    if (carry > 0) {
        result = carry.toString() + result;
    }
  
    return result;
}
  
let sum2 = addStrings2("12345678901234567890", "98765432109876543210");
console.log(sum2);


Challenge 31: Number of words in a text(Solution 1)

Javascript




function countWords1(text) {
    return text.split(/\s+/).filter(word => word !== '').length;
}
  
let inputText = "This is a sample text.";
let wordCount1 = countWords1(inputText);
console.log(wordCount1);


Challenge 31: Number of words in a text(Solution 2)

Javascript




function countWords2(text) {
    return text.split(/\s+/).filter(word => word !== '').length;
}
  
let inputText = "This is a sample text.";
let wordCount2 = countWords2(inputText);
console.log(wordCount2);


Challenge 32: Capitalize the first letter of each word in a text

Javascript




function capitalizeFirstLetter(text) {
    return text.replace(/\b\w/g, char => char.toUpperCase());
}
  
let capitalizedText = capitalizeFirstLetter(inputText);
console.log(capitalizedText);


Challenge 33: Sum of numbers in a comma-delimited string

Javascript




function sumNumbersInString(str) {
    let numbers = str.split(',').map(Number);
    return numbers.reduce((sum, num) => sum + num, 0);
}
  
let sumOfNumbers = sumNumbersInString(commaDelimitedString);
console.log(sumOfNumbers);


Challenge 34: Words inside a text

Javascript




function getWordsArray(text) {
    return text.match(/\b\w+\b/g) || [];
}
  
let wordsArray = getWordsArray(inputText);
console.log(wordsArray);


Challenge 35: Convert CSV text to a bi-dimensional array

Javascript




function csvToBiDimensionalArray(csvText) {
    return csvText.split('\n').map(row => row.split(','));
}
  
let biDimensionalArray = csvToBiDimensionalArray(csvText);
console.log(biDimensionalArray);


Challenge 36: Convert a string to an array of characters

Javascript




let str = "Hello, Geeks!";
let charArray = Array.from(str);
console.log(charArray);


Challenge 37: Convert a string to an array of ASCII codes

Javascript




function stringToAsciiArray(text) {
    return text.split('').map(char => char.charCodeAt(0));
}
  
let asciiArray = stringToAsciiArray(inputString);
console.log(asciiArray);


Challenge 38: Convert an array of ASCII codes to a string

Javascript




function asciiArrayToString(asciiArray) {
    return String.fromCharCode(...asciiArray);
}
  
let asciiArray = [104, 101, 108, 108, 111];
let resultString = asciiArrayToString(asciiArray);
console.log(resultString);


Challenge 39: Implement the Caesar cipher

Javascript




function caesarCipher(text, shift) {
    return text.replace(/[a-zA-Z]/g, char => {
        let baseCharCode = char.toLowerCase() === char ? 'a'.charCodeAt(0) : 'A'.charCodeAt(0);
        let charCode = char.charCodeAt(0);
        let shiftedCharCode = ((charCode - baseCharCode + shift) % 26 + 26) % 26 + baseCharCode;
        return String.fromCharCode(shiftedCharCode);
    });
}
  
let inputText = "Hello, World!";
let encryptedText = caesarCipher(inputText, 3);
console.log(encryptedText);


Challenge 40: Bubble sort algorithm

Javascript




function bubbleSort(arr) {
    let n = arr.length;
    for (let i = 0; i < n-1; i++) {
        for (let j = 0; j < n-i-1; j++) {
            if (arr[j] > arr[j+1]) {
                // swap arr[j] and arr[j+1]
                let temp = arr[j];
                arr[j] = arr[j+1];
                arr[j+1] = temp;
            }
        }
    }
    return arr;
}
  
let numbers = [64, 34, 25, 12, 22, 11, 90];
console.log(bubbleSort(numbers));


Challenge 41: Distance between two points defined by their coordinates

Javascript




function calculateDistance(x1, y1, x2, y2) {
    return Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2));
}
  
let distance = calculateDistance(1, 2, 4, 6);
console.log(distance);


Challenge 42: Check Circle Intersection

Javascript




function areCirclesIntersecting(x1, y1, r1, x2, y2, r2) {
    let distance = calculateDistance(x1, y1, x2, y2);
    return distance < (r1 + r2);
}
  
let intersecting = areCirclesIntersecting(0, 0, 5, 8, 0, 5);
console.log(intersecting);


Challenge 43: Extract Column from 2D Array

Javascript




function extractColumn(matrix, col) {
    return matrix.map(row => row[col]);
}
  
let matrix = [[1, 2, 3], [4, 5, 6], [7, 8, 9]];
let column = extractColumn(matrix, 1);
console.log(column);


Challenge 44: Convert Binary String to Number

Javascript




function binaryStringToNumber(binaryString) {
    return parseInt(binaryString, 2);
}
  
let binaryNumber = binaryStringToNumber("1101");
console.log(binaryNumber);


Challenge 45: Sum of Numbers in Jagged Array

Javascript




function sumJaggedArray(arr) {
    return arr.flat(Infinity).reduce((sum, num) => sum + num, 0);
}
  
let jaggedArray = [1, [2, [3, 4], 5], 6];
console.log(sumJaggedArray(jaggedArray));


Challenge 46: Find Maximum Number in Jagged Array(Solution 1)

Javascript




function findMaxInJaggedArray(arr) {
    return Math.max(...arr.flat(Infinity));
}
  
let jaggedArray = [1, [2, [3, 4], 5], 6];
console.log(findMaxInJaggedArray(jaggedArray));


Challenge 46: Find Maximum Number in Jagged Array(Solution 2)

Javascript




function deepCopyJaggedArray(arr) {
    return JSON.parse(JSON.stringify(arr));
}
  
let jaggedArray = [1, [2, [3, 4], 5], 6];
let copiedArray = deepCopyJaggedArray(jaggedArray);
console.log(copiedArray);


Challenge 47: Deep Copy Jagged Array

Javascript




function deepCopyJaggedArray(arr) {
    return JSON.parse(JSON.stringify(arr));
}
  
let jaggedArray = [1, [2, [3, 4], 5], 6];
let copiedArray = deepCopyJaggedArray(jaggedArray);
console.log(copiedArray);


Challenge 48: Longest Word(s) in a String

Javascript




function longestWords(str) {
    let words = str.split(/\s+/);
    let maxLength = Math.max(...words.map(word => word.length));
    return words.filter(word => word.length === maxLength);
}
  
let sentence = "The quick brown fox jumps over the lazy dog";
console.log(longestWords(sentence));


Challenge 49: Shuffle Array of Strings

Javascript




function shuffleArray(arr) {
    return arr.sort(() => Math.random() - 0.5);
}
  
let stringsArray = ["apple", "banana", "orange", "grape"];
console.log(shuffleArray(stringsArray));


Challenge 50: Generate Unique Random Numbers

Javascript




function generateUniqueRandomNumbers(n) {
    let numbers = Array.from({length: n}, (_, index) => index + 1);
    return shuffleArray(numbers);
}
  
let uniqueRandomNumbers = generateUniqueRandomNumbers(5);
console.log(uniqueRandomNumbers);


Challenge 51: Frequency of Characters in a String

Javascript




function characterFrequency(str) {
    let frequency = {};
    for (let char of str) {
        frequency[char] = (frequency[char] || 0) + 1;
    }
    return Object.entries(frequency).map(([character, occurrences]) => ({ character, occurrences }));
}
  
let inputString = "programming";
console.log(characterFrequency(inputString));


Challenge 52: Calculate Fibonacci(500)

Javascript




function calculateFibonacci(n) {
    let a = BigInt(0);
    let b = BigInt(1);
  
    for (let i = 2; i <= n; i++) {
        [a, b] = [b, a + b];
    }
  
    return b.toString();
}
  
let result = calculateFibonacci(500);
console.log(result);


Challenge 53: Calculate 70! with High Precision

Javascript




function calculateFactorial(n) {
    let result = BigInt(1);
  
    for (let i = 2; i <= n; i++) {
        result *= BigInt(i);
    }
  
    return result.toString();
}
  
let factorial70 = calculateFactorial(70);
console.log(factorial70);


In conclusion, these JavaScript coding challenges are a practical approach for beginners to strengthen their programming skills. These challenges are diverse, encompassing the elements of basic ideas and complicated algorithms that prepare hands-on practice in JavaScript. The simple yet effective solutions act as great references for beginners, making them more confident in solving problems. The process of engaging with these challenges becomes an efficient solution for the newcomers so that their journey to becoming professional JavaScript developers is realized.



Previous Article
Next Article

Similar Reads

Basics of Computer Programming For Beginners
Be it any programming language in which you want to grow your career, It's very important to learn the fundamentals first. Before having a good command over the basic concepts of programming, you cannot imagine the growth in that particular career. Hence, this article will talk about all the basic concepts of programming. Also, if you're a beginner
7 min read
Top 10 Programming Tips For Beginners
Whether you are a novice or have just started to learn programming, there are key tips that can significantly enhance your learning experience. In this blog post, we'll explore the top 10 programming tips for beginners that can help you build a strong foundation and navigate the complexities of coding with confidence. Top 10 Programming Tips For Be
8 min read
7 Ways To Make Programming More Interesting For Beginners
How to make programming more interesting, exciting, and fun...?? It is indeed the common query of almost every programmer, especially the beginner ones. Let's find an effective solution to it in this article.   It’s the 21st day of June and the year is 1948. It is a pleasant summer day for many but for mathematician and computer engineer Tom Kilbur
7 min read
What is Programming? A Handbook for Beginners
Diving into the world of coding might seem intimidating initially, but it is a very rewarding journey that allows an individual to solve problems creatively and potentially develop software. Whether you are interested out of sheer curiosity, for a future career, or a school project, we are here to assist your learning endeavors. We will unravel the
13 min read
Complete Reference for Bitwise Operators in Programming/Coding
There exists no programming language that doesn't use Bit Manipulations. Bit manipulation is all about these bitwise operations. They improve the efficiency of programs by being primitive, fast actions. There are different bitwise operations used in bit manipulation. These Bitwise Operators operate on the individual bits of the bit patterns. Bit op
13 min read
What Is Coding and What Is It Used For?
Coding is the process of designing and building executable computer programs to accomplish a specific task or solve a problem. It involves writing sets of instructions in a programming language that a computer can understand and execute. Coding is a fundamental skill in the field of computer science and plays a crucial role in the development of so
6 min read
List of Coding languages supported by ChatGPT
In the fast-paced world of artificial intelligence, ChatGPT shines as a flexible and robust language model created by OpenAI. This advanced model is crafted to comprehend and produce text that resembles human language, turning it into a priceless tool for a range of uses. Beyond its role as a proficient code assistant, ChatGPT showcases remarkable
4 min read
Pattern Printing question asked in CGI Coding Round
Write a program that receives a number as input and prints it in the following format as shown below. Examples : Input : n = 3 Output : 1*2*3*10*11*12 --4*5*8*9 ----6*7 Input : n = 4 Output : 1*2*3*4*17*18*19*20 --5*6*7*14*15*16 ----8*9*12*13 ------10*11 Asked in CGI coding round Approach: The approach is to see the problem, not as a single task bu
15+ min read
Programming vs Coding - A Short Comparison Between Both
The terms "programming" and "coding" are often used interchangeably, but they can have slightly different nuances in meaning. Programming is a broader and more encompassing term that involves various activities throughout the software development lifecycle, while coding is a specific task within programming that deals with writing the actual lines
3 min read
Why Should I Learn Coding?
Learning coding can offer a variety of benefits, and the decision to learn coding depends on your interests, career goals, and personal development objectives. Table of Content What is Coding?7 Reasons Why You Must Learn Coding1. Attractive Salary and Multiple Career Opportunities2. Develop Problem-Solving and Logical Skills3. Develop Interpersonal
7 min read
How Much Math is Required For Coding?
You might believe that coding careers are for math whizzes and equation nerds. Don't write off your chances of pursuing a profession in programming if that's not you! The truth is that anyone can become a coder, regardless of their expertise in mathematics.  Do you want to know how? You may be surprised at what unfolds ahead. Coding is a field that
10 min read
Different types of Coding Schemes to represent data
Any text-based data is stored by the computer in the form of bits(a series of 1s and 0s), and follows the specified Coding Scheme. The coding scheme is a Standard that tells the user's machine which character represents which set of bytes. Specifying the coding scheme used is very important as without it, the machine could interpret the given bytes
3 min read
How to Start Coding
In this ever-evolving digital landscape, the ability to code is not just a valuable asset but a gateway to creative expression and innovation. This brief guide will outline practical steps and essential principles to guide aspiring learners on their path to mastering the art of coding. Table of Content Introduction, to Basic Syntax. Hello WorldUnde
15+ min read
Types of Issues and Errors in Programming/Coding
"Where there is code, there will be errors" If you have ever been into programming/coding, you must have definitely come across some errors. It is very important for every programmer to be aware of such errors that occur while coding. Table of Content 1. Syntax errors: 2. Logical errors:3. Runtime errors:4. Time Limit exceeded error:In this post, w
13 min read
How to Start Coding: A Beginner's Guide to Learning Programming
In today's digital age, learning programming has become increasingly important. As technology continues to advance, the demand for skilled programmers across various industries is on the rise. Whether you want to pursue a career in tech, develop problem-solving skills, or simply unleash your creativity, learning how to code is a valuable and reward
15+ min read
Convert int to float
Converting an integer to a floating-point number involves changing the data type of the variable from int to float, allowing decimal values. This conversion is useful when performing arithmetic operations that result in fractional values or when working with numerical data that requires precision beyond whole numbers. In this article, we will explo
5 min read
Convert char to int (Characters to Integers)
Converting Characters to Integers is essential in programming, whether it is users' input or extracting values from strings. Every programming language has different techniques to handle the conversion of these lines. In this article, we will explore how to convert characters to integers in several popular programming languages: C, C++, Java, Pytho
4 min read
Implicit and Explicit type casting
In programming, type casting is a way to convert data from one type to another. Implicit type casting happens automatically, while explicit type casting requires manual intervention. This article explores the differences between implicit and explicit type casting, their uses, benefits, and considerations in programming. Table of Content What is Typ
6 min read
Control flow statements in Programming
Control flow refers to the order in which statements within a program execute. While programs typically follow a sequential flow from top to bottom, there are scenarios where we need more flexibility. This article provides a clear understanding about everything you need to know about Control Flow Statements. Table of Content What are Control Flow S
15+ min read
Bitwise XOR Operator in Programming
Bitwise XOR Operator is represented by the caret symbol (^). It is used to perform a bitwise XOR operation on the individual bits of two operands. The XOR operator returns 1 if the corresponding bits in the two operands are different, and 0 if they are the same. Table of Content What is Bitwise XOR?Bitwise XOR operator:Bitwise XOR operator in C:Bit
5 min read
Difference between For Loop and While Loop in Programming
Both for loops and while loops are control flow structures in programming that allow you to repeatedly execute a block of code. However, they differ in their syntax and use cases. It is important for a beginner to know the key differences between both of them. For Loop in Programming:The for loop is used when you know in advance how many times you
3 min read
Basic Programming Problems
Learn Programming – How To Code In the world of programming, mastering the fundamentals is key to becoming a proficient developer. In this article, we will explore a variety of basic programming problems that are essential for every aspiring coder to understand. By delving into these foundational challenges, you will gain valuable insights into pro
4 min read
Data Types in Programming
In Programming, data type is an attribute associated with a piece of data that tells a computer system how to interpret its value. Understanding data types ensures that data is collected in the preferred format and that the value of each property is as expected. Table of Content What are Data Types in Programming?Common Data Types in ProgrammingCom
11 min read
Conditional Statements in Programming | Definition, Types, Best Practices
Conditional statements in programming are used to control the flow of a program based on certain conditions. These statements allow the execution of different code blocks depending on whether a specified condition evaluates to true or false, providing a fundamental mechanism for decision-making in algorithms. In this article, we will learn about th
15+ min read
Functions in Programming
Functions in programming are modular units of code designed to perform specific tasks. They encapsulate a set of instructions, allowing for code reuse and organization. In this article, we will discuss about basics of function, its importance different types of functions, etc. Table of Content What are Functions in Programming?Importance of Functio
14 min read
Variable in Programming
In programming, we often need a named storage location to store the data or values. Using variables, we can store the data in our program and access it afterward. In this article, we will learn about variables in programming, their types, declarations, initialization, naming conventions, etc. Table of Content What are Variables In Programming?Decla
11 min read
Loops in Programming
Loops or Iteration Statements in Programming are helpful when we need a specific task in repetition. They're essential as they reduce hours of work to seconds. In this article, we will explore the basics of loops, with the different types and best practices. Table of Content What are Loops in Programming?Types of Loops in ProgrammingFor loopWhile L
12 min read
Program to Print Butterfly Pattern (Star Pattern)
Given an integer N, print N rows of Butterfly pattern. Examples: Input: 3Output: * *** ********* *** * Input: 5Output: * *** ***** ******* ***************** ******* ***** *** * Approach: The problem can be solved using three nested loops inside an outer loop. The outer loop will run for the rows, the first inner loop will print the stars, the secon
6 min read
Introduction of Programming Paradigms
Paradigm can also be termed as method to solve some problem or do some task. Programming paradigm is an approach to solve problem using some programming language or also we can say it is a method to solve a problem using tools and techniques that are available to us following some approach. There are lots for programming language that are known but
11 min read
Program to print ASCII Value of a character
Given a character, we need to print its ASCII value in C/C++/Java/Python. Examples : Input : a Output : 97 Input : DOutput : 68 Here are few methods in different programming languages to print ASCII value of a given character :  Python code using ord function : ord() : It converts the given string of length one, returns an integer representing the
4 min read