As a newbie programmer
As a newbie programmer

As a newbie programmer

Sharing entry level codes. My snippets on GitHub https://github.com/locharp/code-snippets


Find me the divisor count @ Dcoder

27 Jun 2023 1 minute read 0 comments Lochard

Problem: Cody was solving a programming puzzle in Dcoder, and as always he is unable to do it alone. Puzzle statement is You are given three integers l,h,d and you have to find that how many integers between l and h (inclusive) are divisible by d.Let...

Square of squares @ Dcoder

26 Jun 2023 1 minute read 0 comments Lochard

Problem: You have a hobby of building blocks. You are especially fond of building blocks that are squares. And what you even like more, is to arrange them into a square of square building blocks! /n However, sometimes, you are unable to achieve this...

Capitalize me @ Dcoder

25 Jun 2023 1 minute read 0 comments Lochard

Problem: You will be given a string, all you have to do is capitalize first letter of each word in the given string. Input: Input contains a string s. Output: Print the manipulated string according to the problem described. Constraints: 1≤s length≤10...

I'll be the next @ Dcoder

24 Jun 2023 1 minute read 0 comments Lochard

Problem: You are given a string, you have to convert each letter in the string with the next one.For example a becomes b and C becomes D. Input: Input contains a string s. Output: Print the manipulated string according to the problem. Constraints: 1≤...

The Report Card! @ Dcoder

23 Jun 2023 1 minute read 0 comments Lochard

Problem: Priyanka is Professor at Zing University. Help the professor in assigning grades to her students.   The mean score of three subjects is to graded into 'A', 'B', 'C' or 'D' or 'F' depending upon the marks scored.   For the score >90 and score...

The Secure function : Xr @ Dcoder

4 Jun 2023 1 minute read 0 comments Lochard

Title: The Secure function : Xr Problem: Cody is learning cryptography and security.The security book starts with a mathematics based problem. Say set X is collection of elements, for example X = {1,2,3} . Given 2 sets X and Y, We define a function f...

The bit flipper @ Dcoder

2 Jun 2023 1 minute read 0 comments Lochard

Problem: You are given a binary number, you just need to flip each and every bit of it ie. 1 turns to 0 and 0 turns to 1. Input: Input contains a binary number. Output: Print the flipped binary number. Constraints: The binary number can be any binary...

Exponentia! @ Dcoder

1 Jun 2023 1 minute read 0 comments Lochard

Problem: Create a code that allows people to learn about exponents. The task is to write a code which takes an integer number as an input and returns the values ranging from that of 2(two) raised to power 0(zero) to 2(two) raised to power n(the numbe...

Binary to Decimal @ Dcoder

31 May 2023 1 minute read 0 comments Lochard

Problem: Write a code which converts a binary number (written as string) into a decimal number. Input: Input is a binary number. Output: The output is a decimal number.(interger value) Constraints: The binary number is non-negative and the resultant...

First Half!! @ Dcoder

28 May 2023 1 minute read 0 comments Lochard

Problem: Given a string return its first half.Assume string to have even number of characters. Input: Input contains a string Output: Print the first half of string. Constraints: 0≤string length≤100 Sample Input: Dcoder Sample Output:  Dco s = input(...