Arnab Chakraborty has Published 4293 Articles

ASCII NUL, ASCII 0 (‘0’) and Numeric literal 0?

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Jul-2019 22:30:26

7K+ Views

Here we will see the ASCII NUL, ASCII 0 and the Numeric Literal 0. The ASCII null is represented as 0x00, and zero is represented as 0x30. The ASCII NUL character is used to denote the end of the string in C or C++. When programmer used ‘0’ (character 0) ... Read More

Average of first n odd naturals numbers?

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Jul-2019 22:30:26

269 Views

Here we will see how to get the average of n odd natural numbers. The n is given by the user. To get the ith odd number we can use this formula 2*i+1. Here also we are using this formula. Let us see the algorithm to get the clear idea.AlgorithmavgOddNaturalNumber(n)Begin ... Read More

Bash program to check if the Number is a Palindrome?

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Jul-2019 22:30:26

4K+ Views

To check whether a number is palindrome or not, we have to reverse the number, and then if the actual number and the reversed number are same, then this is palindrome. In Bash, performing the reverse operation is very easy. We have to use the ‘rev’ command to do that. ... Read More

Bash program to find A to the power B?

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Jul-2019 22:30:26

3K+ Views

Here we will see how to get the number A raise to the power B using bash script. The logic is very simple. We have to use the ‘**’ operator or power operator to do this. Let us see the following program to understand the concept clearly.Example#!/bin/bash # GNU bash ... Read More

Bisymmetric matrix in C++?

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Jul-2019 22:30:26

199 Views

Here we will see one program that will help to check whether a matrix is bisymmetric or not. The Bisymmetric matrix is one square matrix that are symmetric about both of the major diagonals. The below matrix is an example of bisymmetric matrix.1 2 3 4 5 2 6 7 ... Read More

C/C++ Program for Median of two sorted arrays of same size?

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Jul-2019 22:30:26

357 Views

Here we will see how to get the median of two sorted array of the same size. We will use C++ STL to store array elements. After getting two arrays, we will merge them into one. As two arrays of same size are merged, then the final array will always ... Read More

C Program for compound interest?

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Jul-2019 22:30:26

1K+ Views

Here we will see how to get the compound interest by writing one C program. The logic is very easy. Here we need some parameters −P − Principle amountR − Rate of interestT − Time spanThe compound interest formula is like belowExample#include #include float compoundInterest(float P, float T, float R) ... Read More

C Program for cube sum of first n natural numbers?

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Jul-2019 22:30:26

2K+ Views

In this problem we will see how we can get the sum of cubes of first n natural numbers. Here we are using one for loop, that runs from 1 to n. In each step we are calculating cube of the term and then add it to the sum. This ... Read More

C Program for Difference between sums of odd and even digits?

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Jul-2019 22:30:26

605 Views

Suppose we have one long integer. We have to find if the differences between the sum of the odd position digits, and the sum of the even position digits are 0 or not. The positions are start from 0 (left most).For example, suppose a number is 156486. The odd position ... Read More

C Program for efficiently print all prime factors of a given number?

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Jul-2019 22:30:26

700 Views

In this section, we will see how we can get all the prime factors of a number in an efficient way. There is a number say n = 1092, we have to get all prime factors of this. The prime factors of 1092 are 2, 2, 3, 7, 13. To ... Read More

Advertisements