- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Sudhir sharma has Published 1208 Articles
sudhir sharma
1K+ Views
Sum of all Array elements means add all array Elements. Suppose we have 5 Elements in array and we want to find there sum.arr[0]=1 arr[1]=2 arr[2]=3 arr[3]=4 arr[4]=5Sum off all above elements arearr[0]+arr[1]+arr[2]+arr[3]+ arr[4]=1+2+3+4+5=15Input:1, 2, 3, 4, 5 Output:15ExplanationUsing For loop to get to the every index element and taking ... Read More
sudhir sharma
2K+ Views
Given a number, find the difference between sum of odd digits and sum of even digits. Which means we will be count all even digits and all odd digits and the subtracting their sums.SampleInput:12345 Output:3Explanationthe odd digits is 2+4=6 the even digits is 1+3+5=9 odd-even=9-6=3Taking every digit out of number ... Read More
sudhir sharma
437 Views
The cube sum of first n natural numbers is the program to add cubes of all natural numbers up to n. It is sum of series 1^3 + 2^3 + …. + n^3 that is sum of cube of n natural numbers.Input:6 Output:441Explanation1^3 + 2^3 + 3^3 + 4^3 + ... Read More
sudhir sharma
173 Views
Compound interest is the simple interest that is compounded annually i.e. the interest will be calculated and added to the principal amount every year. This increases the overall interest as compared to simple interest. There is a different mathematical formula to calculate the compound interest. Lets see with the an ... Read More
sudhir sharma
563 Views
The Fibonacci sequence is a series where the next term is the sum of the previous two terms.The first two terms of the Fibonacci sequence is 0 followed by 1. In this problem, we will find the nth number in the Fibonacci series. For this we will calculate all the numbers ... Read More
sudhir sharma
379 Views
In Bubble sort compares adjacent pairs and swaps them if they are in the wrong order. In this type of bubble sort we use the recursive function that calls itself.Input:53421 Output:12345ExplanationUse of recursive (self-calling) function compares adjacent pairs and swaps them if they are in the wrong order until the ... Read More
sudhir sharma
145 Views
We need to compute sum of elements from index i to index j. The queries consisting of i and j index values will be executed multiple times.Input:arr[] = {5, 6, 3, 4, 1 } i = 1, j =3 Output: 13Explanation6 + 3 + 4 = 13 sum[] = {5, ... Read More
sudhir sharma
119 Views
Two integers X and K are given. K is the number of digit in integer number. The logic is to find largest K-digit number divisible by X.Input: X = 30, K = 3 Output: 980Explanation980 is the largest three digit number divisible by 30. By taking the K in power ... Read More
sudhir sharma
159 Views
Gnome sort is a sorting algorithm which is similar to Insertion sort, except that moving an element to its proper place is accomplished by a series of swaps, as in bubble sort.Input: 53421 Output: 12345ExplanationSorting algorithm that moving an element to its proper place is accomplished by a series of ... Read More
sudhir sharma
1K+ Views
The common divisor of two numbers are the numbers that are divisors of both of them.For example, the divisors of 12 are 1, 2, 3, 4, 6, 12. The divisors of 18 are 1, 2, 3, 6, 9, 18. Thus, the common divisors of 12 and 18 are 1, 2, ... Read More
To Continue Learning Please Login
Login with Google