 
 Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Programming Articles - Page 1969 of 3366
 
 
			
			623 Views
In this problem, we are given a number N. Our task is to create a Program to find last two digits of Nth Fibonacci number in C++.Problem DescriptionWe need to find the last two digits (i.e. the two LSB’s ) of the Nth Fibonacci number. Let’s take an example to understand the problem, Input: N = 120 Output: 81Solution ApproachA simple solution will be using the direct Fibonacci formula to find the Nth term. But this method will not be feasible when N is a large number. So to overcome this, we will use the property of the Fibonacci Series that ... Read More
 
 
			
			210 Views
In this problem, we are given two numbers N and M. Our task is to create a program to find LCM of two Fibonacci Numbers in C++.Problem Description − We will find the Nth and Mth Fibonacci number. And then we will find the LCM of their two numbers and return the result.Fibonacci Numbers0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377....Let’s take an example to understand the problem, Input: N = 4, B = 9Output:Explanation4th Fibonacci number is 29th Fibonacci number is 21LCM is 42.Solution ApproachTo solve the problem, we need to find ... Read More
 
 
			
			633 Views
In this problem, we are given a number N. Our task is to create a Program to find last two digits of 2^n in C++.Problem DescriptionTo find the last two digits. We will use only the product of the last two digits. And leave other things to make the calculation small.Let’s take an example to understand the problem, Input: N = 12 Output: 96Explanation2^12 = 4096Solution ApproachTo solve the problem, a direct approach could be finding the value of 2^N and then finding the remainder when it is divided by 100.Example Live Demo#include using namespace std; int findLastDigit(int N){ int ... Read More
 
 
			
			585 Views
In this problem, we are given a number N. Our task is to create a Program to find last digit of Nth Fibonacci number in C++.Problem DescriptionWe need to find the last digit (i.e. LSB ) of the Nth Fibonacci number.Let’s take an example to understand the problem, Input: N = 120 Output: 1Solution ApproachA simple solution will be using the direct Fibonacci formula to find the Nth term. But this method will not be feasible when N is a large number. So to overcome this thing, we will use the property of the Fibonacci Series that the last digit ... Read More
 
 
			
			494 Views
In this tutorial, we will be discussing a program to find the largest element in an array.For this, we will be provided with an array. Our task is to find the largest number from the elements inside the array.Example Live Demo#include using namespace std; //finding largest integer int largest(int arr[], int n){ int i; int max = arr[0]; //traversing other elements for (i = 1; i < n; i++) if (arr[i] > max) max = arr[i]; return max; } int main(){ int arr[] = {10, 324, 45, 90, 9808}; int n = sizeof(arr) / sizeof(arr[0]); cout
 
 
			
			256 Views
In this tutorial, we will be discussing a program to find if a character is a vowel or consonant.For this, we will be provided with a character. Our task is to print out to the user whether the provided character is a vowel or a consonant.Example Live Demo#include using namespace std; //checking if the character is a vowel or consonant void is_vowel(char x){ if (x == 'a' || x == 'e' || x == 'i' || x == 'o' || x == 'u') cout
 
 
			
			255 Views
In this tutorial, we will be discussing a program to find HCF iteratively.For this, we will be provided with two numbers. Our task is to calculate the HCF of the given numbers using an iterative function.Example Live Demo#include using namespace std; int get_HCF(int a, int b){ while (a != b){ if (a > b) a = a - b; else b = b - a; } return a; } int main(){ int a = 60, b = 96; cout
 
 
			
			161 Views
In this tutorial, we will be discussing a program to find N-th term of series 3, 5, 33, 35, 53…For this, we will be provided with a number. Our task is to find the term for the given series at that particular position.Example Live Demo#include using namespace std; //finding the nth term in the series int printNthElement(int n){ int arr[n + 1]; arr[1] = 3; arr[2] = 5; for (int i = 3; i
 
 
			
			164 Views
JShell is a Java Shell tool used to execute simple java statements like classes, methods, interfaces, enums, and etc.. evaluates it, and prints the result in a command-line prompt.Java has improved Process API to manage and control operating system processes. ProcessHandle interface identifies and provides control of native processes, methods to check processes liveness, and destroy the process. ProcessHandle.Info interface gives an Information snapshot of a process.In the below code snippet, we can print pid, info, children, and destroy processes of Process API.in JShell tool.Snippetjshell> ProcessHandle currentProcess = ProcessHandle.current(); currentProcess ==> 3960 jshell> System.out.println("Current Process Id: = " + currentProcess.pid()); Current Process Id: = 3960 jshell> ... Read More
 
 
			
			1K+ Views
Suppose we have an array w of positive integers, were w[i] describes the weight of index i, we have to define a function pickIndex() which randomly picks an index in proportion to its weight.So if the input is like [1, 3], call pickIndex() five times, then the answer may come as − 0, 1, 1, 1, 0.To solve this, we will follow these steps −Define an array v, Through the initializer, initialize asn := w[0]for i in range 1 to size of ww[i] := w[i] + w[i – 1]n := w[i]v = wThe pickIndex() will work as follows −Take a ... Read More