33
Total Posts
3
Categories
24/7
Updated

💻 Code Library

Browse reusable code snippets by category.

C++

Write a program to find the matrix inversion by using Gauss-elimination method / Gauss Seidel method.

Input Enter order of matrix (n): 2Enter elements of matrix:2 15 3 Output Inverse Matrix is:3   -1-5  2 &nb…

View Code → #write-a-program-to-find-the-matrix-inversion-by-using-gauss-elimination-method-gauss-seidel-method
C++

Write a program to find the numerical solution of Differential equations by using Runge Kutta method / Euler method.

Output Using Euler Methodx       y0       10.1     1.10.2     1.220.3 …

View Code → #write-a-program-to-find-the-numerical-solution-of-differential-equations-by-using-runge-kutta-method-euler-method
C++

Write a program to find the value of numerical integration by using/ Trapezoidal Rule/ Simpson’s one-third rule/ Simpson’s 3/8 rule.

Input Choose Method:1. Trapezoidal Rule2. Simpson's 1/3 Rule3. Simpson's 3/8 RuleEnter choice: 2Enter lower limit a and…

View Code → #write-a-program-to-find-the-value-of-numerical-integration-by-using-trapezoidal-rule-simpson-s-one-third-rule-simpson-s-3-8-rule
C++

Write a program to find f(x) by using Lagrange Interpolation/ Newtonian Interpolation.

Input Enter number of data points: 4Enter x values:1 2 3 4Enter corresponding y values:1 8 27 64Enter value of x to fin…

View Code → #write-a-program-to-find-f-x-by-using-lagrange-interpolation-newtonian-interpolation
C++

Write a program to determine the roots by using Bisection Method / Regula-Falsi Method / Newton Raphson Method.

Input Choose Method:1. Bisection Method2. Regula-Falsi Method3. Newton-Raphson MethodEnter choice: 1Enter initial guess…

View Code → #write-a-program-to-determine-the-roots-by-using-bisection-method-regula-falsi-method-newton-raphson-method
C++

Write a program to generate the Fibonacci sequence using recursion and find the number that are perfect square.

Input Enter number of terms: 10 Output Fibonacci Series:0 1 1 2 3 5 8 13 21 34 Number of Fibonacci numbers that are …

View Code → #write-a-program-to-generate-the-fibonacci-sequence-using-recursion-and-find-the-number-that-are-perfect-square
C++

Write a program to construct a magic square of dimension n × n (n odd).

Input Enter an odd number (n):  3 Output Magic Square of size 3 × 3:8   1   63   5   7…

View Code → #write-a-program-to-construct-a-magic-square-of-dimension-n-n-n-odd
C++

Write a program to multiply two numbers having more than 15 digits each.

Input Enter first large number: 123456789123456Enter second large number: 987654321987654 OutputProduct: 1219326313565…

View Code → #write-a-program-to-multiply-two-numbers-having-more-than-15-digits-each
C++

Test the truth of Bertrand conjecture (Bertrand conjecture is that there is at least one prime between n and 2n).

Input Enter value of n (n > 1): 10 OutputPrime numbers between 10 and 20 are:11 13 17 19Bertrand conjecture is TRUE…

View Code → #test-the-truth-of-bertrand-conjecture-bertrand-conjecture-is-that-there-is-at-least-one-prime-between-n-and-2n
C++

Write a C++ program to use pointer for both base and derived classes and call the member function. Use Virtual keyword.

Output This is Derived class show() function -------------------------------------------------------------------------…

View Code → #write-a-c-program-to-use-pointer-for-both-base-and-derived-classes-and-call-the-member-function-use-virtual-keyword
C++

Write a C++ program to create an array of pointers. Invoke functions using array objects.

Output Student Details:Roll Number: 100Roll Number: 101Roll Number: 102     Student *ptr[3] → arr…

View Code → #write-a-c-program-to-create-an-array-of-pointers-invoke-functions-using-array-objects
C++

Write a C++ program to create multilevel inheritance. (Hint: Classes A1, A2, A3).

Output This is class A1This is class A2This is class A3   Explanation Multilevel inheritance occurs when a …

View Code → #write-a-c-program-to-create-multilevel-inheritance-hint-classes-a1-a2-a3
C++

Write a C++ program to allocate memory using new operator.

Output Value stored in dynamically allocated memory: 25   Important Points new allocates memory at runtime …

View Code → #write-a-c-program-to-allocate-memory-using-new-operator
C++

Write a C++ program to use scope resolution operator. Display the various values of the same variables declared at different scope levels.

Output Local x       = 10Class x       = 50Global x      = 100   …

View Code → #write-a-c-program-to-use-scope-resolution-operator-display-the-various-values-of-the-same-variables-declared-at-different-scope-levels
C++

Write a C++ to illustrate the concepts of console I/O operations.

Input Enter your name: Rahul KumarEnter your age: 20Enter your marks: 85.5   Output ---- Student Details ----Na…

View Code → #write-a-c-to-illustrate-the-concepts-of-console-i-o-operations
C++

Write a C++ program to read the data of N employee and compute Net salary of each employee (DA=52% of Basic and Income Tax (IT) =30% of the gross salary).

Input Enter number of employees: 2 Enter details of Employee 1Enter Employee Number: 101Enter Employee Name: RahulEnte…

View Code → #write-a-c-program-to-read-the-data-of-n-employee-and-compute-net-salary-of-each-employee-da-52-of-basic-and-income-tax-it-30-of-the-gross-salary
C++

Given that an EMPLOYEE class contains following members: data members: Employee number, Employee name, Basic, DA, IT, Net Salary and print data members.

Input Enter Employee Number: 101Enter Employee Name: Amit KumarEnter Basic Salary: 20000Enter DA: 5000Enter IT: 2000 &…

View Code → #given-that-an-employee-class-contains-following-members-data-members-employee-number-employee-name-basic-da-it-net-salary-and-print-data-members
C++

Write a C++ program to declare a class. Declare pointer to class. Initialize and display the contents of the class member.

Output Roll No: 101 Grade: A Important Points (For Exams) A pointer to class stores the address of an ob…

View Code → #write-a-c-program-to-declare-a-class-declare-pointer-to-class-initialize-and-display-the-contents-of-the-class-member
C++

Write a C++ program to declare Struct. Initialize and display the contents of member variables

Output   Student DetailsRoll No: 101Name: RahulGrade: A     struct is used to group different data…

View Code → #write-a-c-program-to-declare-struct-initialize-and-display-the-contents-of-member-variables
C++

Write a C++ program to display Names, Roll No., and grades of 3 students who have appeared in the examination. Declare the class of name, Roll No. And grade. Create array of class objects. Read and display the contents of the array.

A class Student is declared with: name rollNo grade An array of class objects is created for…

View Code → #write-a-c-program-to-display-names-roll-no-and-grades-of-3-students-who-have-appeared-in-the-examination-declare-the-class-of-name-roll-no-and-grade-create-array-of-class-objects-read-and-display-the-contents-of-the-array
C++

Hello World in C++

#include <iostream>: This is a preprocessor directive that includes the iostream (input/output strea…

View Code → #hello-world-in-cpp
C

Hello Wold in C

#include <stdio.h>: This is a preprocessor directive that tells the C compiler to include the standard input/out…

View Code → #hello-world-in-c