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


Fare @ Dcoder

9 May 2023 1 minute read 0 comments Lochard

Problem: John is travelling by train, The fare of the train depends on the kilometer he traveled. For the first A kilometer, the fare is M and for the subsequent distance, it is N per kilometer. You are given total distance covered by train. Find out...

Ordinal Representation @ Dcoder

8 May 2023 1 minute read 0 comments Lochard

Problem: Numbers can be represented in cardinal form or ordinal form. Cardinal Form : 1, 2, 3, 4, 5, 6, etc. Ordinal Form : 1st, 2nd, 3rd, 4th, 5th, 6th, etc. You will be given cardinal form of a digit. You have to print its ordinal form. Input: A si...

The Beta Test Initiation @ Dcoder

7 May 2023 1 minute read 0 comments Lochard

Problem: Dcoder Team is working on an exciting new update in the app, but before releasing it to the public, our team has decided to test the app out on small percentage of users. This is known as the Beta Test. For a user to be eligible for a Beta T...

Dr. Primo visits ArrayCon @ Dcoder

4 May 2023 1 minute read 0 comments Lochard

Problem: Dr. Primo is a famous mathematician in Codeland. He is known to have numbers as his friends. He is especially in love with Prime Numbers. He goes to the city festival ArrayCon. Every time he is given an array, he tells how many prime numbers...

First and the Last Digit @ Dcoder

30 Apr 2023 1 minute read 0 comments Lochard

Title: First and the Last Digit Problem: Ron is weak in mathematics.Knowing this fact John challenges him to find the sum of first and last digit of a given number. Help Ron to find the sum of first and last digit of a number. Input: The first line c...

The Running Race @ Dcoder

29 Apr 2023 1 minute read 0 comments Lochard

Problem: Alex and Ryan are having a running competition between themselves. They have to cover a distance of D meter. The speed of Alex and Ryan are X meter/second and Y meter/second respectively. Help the judge by telling him who will win the compet...

Grade the Students @Dcoder

28 Apr 2023 1 minute read 0 comments Lochard

Problem: In Dcoder school, a student will pass if he/she satisfies the following criteria: 1. If he/she gets more than 70 marks in Mathematics. 2. If he/she gets more than 50 marks in Algorithms. Given the marks of Mathematics and Algorithms, print w...

Divide The Array @ Dcoder

27 Apr 2023 1 minute read 0 comments Lochard

Problem: Cody loves even numbers. He was bored and decided to print all the even numbers at the even indexes of an array(1-indexed). He wants your help to complete this task. Input: The first line of the input contains an integer N denoting the size...

What's the ASCII? @ Dcoder

26 Apr 2023 1 minute read 0 comments Lochard

Problem: You will be given a character having ASCII Code between 33 to 127. You need to print the ASCII Code of the character. Input: A single character. Output: Print the ASCII Code of the character in decimal form. Constraints: Character will have...

The Largest Gap @ Dcoder

17 Apr 2023 1 minute read 0 comments Lochard

Problem: Cody's teacher taught him the concept of arrays. She gave different types of homework for all the students so they won't able to copy. Cody has to find the largest gap between any two elements in the array. As Cody has a date with his girlfr...