Articles on Trending Technologies

Technical articles with clear explanations and examples

C++ program to find Nth term of the series 1, 8, 54, 384…

sudhir sharma
sudhir sharma
Updated on 11-Mar-2026 208 Views

In this problem, we are given an integer N. Our task is to create a program to Find Nth term of series 1,8, 54, 384 ...Let’s take an example to understand the problem,InputN = 4Output384Explanation4th term − (4 * 4 * (4!) = 384Solution ApproachA simple approach to solve the problem is by using the general formula for the nth term of the series. The formula for,Nth term = ( N * N * (N !) )Program to illustrate the working of our solution,Example#include using namespace std; int calcFact(int N) {    int fact = 1;    for (int i = 1; i

Read More

C++ program to find Nth term of the series 3, 14, 39, 84…

sudhir sharma
sudhir sharma
Updated on 11-Mar-2026 213 Views

In this problem, we are given an integer N. Our task is to create a program to Find Nth term of series 3, 14, 39, 84…Let’s take an example to understand the problem,InputN = 4Output84Explanation4th term − ( (4*4*4) + (4*4) + 4 ) = 64 + 16 + 4 = 84Solution ApproachA simple approach to solve the problem is by using the general formula for the nth term of the series. The formula for,Nth term = ( (N*N*N) + (N*N) + (N))Program to illustrate the working of our solution,Example#include using namespace std; int calcNthTerm(int N) {    return ( (N*N*N) + (N*N) + (N) ); } int main() {    int N = 6;    cout

Read More

Golang Program to delete the first node from a linked list.

Rishikesh Kumar Rishi
Rishikesh Kumar Rishi
Updated on 11-Mar-2026 667 Views

ExampleApproach to solve this problemStep 1 − Define a method that accepts the head of a linked list.Step 2 − If head == nil, return the head.Step 3 − Go to the next node and return the updated head.Examplepackage main import "fmt" type Node struct {    value int    next *Node } func NewNode(value int, next *Node) *Node{    var n Node    n.value = value    n.next = next    return &n } func TraverseLinkedList(head *Node){    temp := head    for temp != nil {       fmt.Printf("%d ", temp.value)       temp = temp.next ...

Read More

C++ program to find nth term of the series 5, 2, 13 41,...

sudhir sharma
sudhir sharma
Updated on 11-Mar-2026 249 Views

In this problem, we are given an integer N. Our task is to create a program to Find Nth term of series 5, 2, 19, 13, 41, 31, 71, 57…Let’s take an example to understand the problem, InputN = 5Output41ExplanationThe series is − 5, 2, 19, 13, 41, …Solution ApproachA simple approach to solve the problem is by using the general formula for the nth term of the series. The series has different formulas for even and odd values.The Nth term is given by, Nth term = (N-1)^2 + N, if N is even i.e N%2 == 0 Nth term ...

Read More

Golang Program to delete the last node from a linked list.

Rishikesh Kumar Rishi
Rishikesh Kumar Rishi
Updated on 11-Mar-2026 504 Views

ExamplesApproach to solve this problem −Step 1 − Define a method that accepts the head of a linked list.Step 2 − If head == nil, return the head.Step 3 − Go to the next node and return the updated head.Examplepackage main import (    "fmt" ) type Node struct {    value int    next *Node } func NewNode(value int, next *Node) *Node{    var n Node    n.value = value    n.next = next    return &n } func TraverseLinkedList(head *Node){    temp := head    for temp != nil {       fmt.Printf("%d ", temp.value)     ...

Read More

Python Program to Find the Area of a Rectangle Using Classes

AmitDiwan
AmitDiwan
Updated on 11-Mar-2026 4K+ Views

When it is required to find the area of a rectangle using classes, object oriented method is used. Here, a class is defined, attributes are defined. Functions are defined within the class that perform certain operations. An instance of the class is created, and the functions are used to find the area of rectangle.Below is a demonstration for the same −Exampleclass shape_rectangle(): def __init__(self, my_length, my_breadth):    self.length = my_length    self.breadth = my_breadth def calculate_area(self):    return self.length*self.breadth len_val = 6 bread_val = 45 print("The length of the rectangle is : ") print(len_val) print("The breadth of the rectangle is ...

Read More

C++ program to find Nth term of the series 5, 13, 25, 41, 61…

sudhir sharma
sudhir sharma
Updated on 11-Mar-2026 251 Views

In this problem, we are given an integer N. Our task is to create a program to Find Nth term of series 5, 13, 25, 41, 61, …Let’s take an example to understand the problem,InputN = 5Output61ExplanationThe series is − 5, 13, 25, 41, 61…Solution ApproachA simple approach to solve the problem is by using the general formula for the nth term of the series. The Nth term is given by,Nth term = ( (N*N) + ((N+1)*(N+1)) )Program to illustrate the working of our solution,Example#include using namespace std; int calcNthTerm(int N) {    return ( ( (N + 1)*( N + 1) ) + (N*N) ) ; } int main() {    int N = 7;    cout

Read More

Golang Program to update the first node value in a linked list.

Rishikesh Kumar Rishi
Rishikesh Kumar Rishi
Updated on 11-Mar-2026 270 Views

ExampleApproach to solve this problemStep 1 − Define a method that accepts the head of a linked list.Step 2 − If head == nil, return the head.Step 3 − Else, update the first node value to 29.Examplepackage main import "fmt" type Node struct {    value int    next *Node } func NewNode(value int, next *Node) *Node{    var n Node    n.value = value    n.next = next    return &n } func TraverseLinkedList(head *Node){    temp := head    for temp != nil {       fmt.Printf("%d ", temp.value)       temp = temp.next    } ...

Read More

Python Program to Append, Delete and Display Elements of a List Using Classes

AmitDiwan
AmitDiwan
Updated on 11-Mar-2026 2K+ Views

When it is required to append, delete, and display the elements of a list using classes, object oriented method is used. Here, a class is defined, and attributes are defined. Functions are defined within the class that perform certain operations. An instance of the class is created, and the functions are used to add elements to the list, delete elements from the list and display the elements of the list using objects.Below is a demonstration for the same −Exampleclass list_class():    def __init__(self):       self.n=[]    def add_val(self, a):       return self.n.append(a)    def remove_val(self, b): ...

Read More

Find number from its divisors in C++

sudhir sharma
sudhir sharma
Updated on 11-Mar-2026 278 Views

In this problem, we are given an array divisors[] consisting of N integers which are the divisors of a number Num. Our task is to find the number from its divisors.The divisor array does not include 1 and the number.Let’s take an example to understand the problem, Inputdivisors[] = {3, 25, 5, 15}Output75ExplanationThe number 75 has divisors {3, 25, 5, 15}Solution ApproachTo solve the problem, we need to find the number Num using the smallest and largest divisors of the number.Num = smallest * largestFor this, we need to sort the array divisors[] and then find the product of elements ...

Read More
Showing 1461–1470 of 61,248 articles
« Prev 1 145 146 147 148 149 6125 Next »
Advertisements