Sunidhi Bansal

Sunidhi Bansal

809 Articles Published

Articles by Sunidhi Bansal

Page 5 of 81

C Program for FCFS Scheduling

Sunidhi Bansal
Sunidhi Bansal
Updated on 15-Mar-2026 56K+ Views

We are given with the n number of processes i.e. P1, P2, P3, ..., Pn and their corresponding burst times. The task is to find the average waiting time and average turnaround time using FCFS CPU Scheduling algorithm. What is Waiting Time and Turnaround Time? Turnaround Time is the time interval between the submission of a process and its completion. Turnaround Time = completion of a process − submission of a process Waiting Time is the difference between turnaround time and burst time Waiting Time = turnaround time − burst time What is FCFS Scheduling? ...

Read More

C Program for focal length of a lens

Sunidhi Bansal
Sunidhi Bansal
Updated on 15-Mar-2026 463 Views

In optics, the focal length is a fundamental property of lenses that determines their converging or diverging power. Given the image distance and object distance from a lens, we can calculate the focal length using the lens equation. What is Focal Length? Focal length of an optical system is the distance between the center of lens or curved mirror and its focus. It represents the distance over which initially collimated rays are brought to a focus. ...

Read More

C Program for Hexagonal Pattern

Sunidhi Bansal
Sunidhi Bansal
Updated on 15-Mar-2026 2K+ Views

We are given with an integer 'n' and the task is to generate the hexagonal pattern and display the final output. Syntax void pattern(int n); Example Let's see the hexagonal pattern for n=5 and n=4 − Input: n=5 Output: * * * * * * * * * * * * * * ...

Read More

C Program for Circumference of a Parallelogram

Sunidhi Bansal
Sunidhi Bansal
Updated on 15-Mar-2026 239 Views

We are given the sides of a parallelogram and the task is to calculate the circumference of the parallelogram with its given sides and display the result. What is a Parallelogram? A parallelogram is a type of quadrilateral which has − Opposite sides parallel and equal Opposite angles equal Diagonals bisect each other In the below figure, 'a' and 'b' are the sides of a parallelogram where parallel sides are shown. a a b b ...

Read More

C program for Binomial Coefficients table

Sunidhi Bansal
Sunidhi Bansal
Updated on 15-Mar-2026 8K+ Views

Given with a positive integer value let's say 'val' and the task is to print the value of binomial coefficient B(n, k) where, n and k be any value between 0 to val and hence display the result. What is Binomial Coefficient Binomial coefficient (n, k) is the order of choosing 'k' results from the given 'n' possibilities. The value of binomial coefficient of positive n and k is given by − Syntax C(n, k) = n! / (k! * (n-k)!) where, n >= k Example of Binomial Coefficient Calculation For ...

Read More

C Program for sum of cos(x) series

Sunidhi Bansal
Sunidhi Bansal
Updated on 15-Mar-2026 5K+ Views

We are given with the value of x and n where, x is the angle for cos and n is the number of terms in the cos(x) series. The cosine series allows us to calculate cos(x) using polynomial approximation instead of built-in trigonometric functions. Cos(x) Function Cos(x) is a trigonometric function which calculates the cosine of an angle. It can be represented as an infinite series using Taylor expansion. Cosine Function Properties: • Range: [-1, 1] • Period: 2π radians (360°) • cos(0) = 1, cos(π/2) = 0 ...

Read More

C Program for nth Catalan Number

Sunidhi Bansal
Sunidhi Bansal
Updated on 15-Mar-2026 2K+ Views

Given an integer n, the task is to find the Catalan Number at the nth position. Catalan numbers are a sequence of natural numbers that occur in various counting problems in combinatorics and computer science. Catalan numbers C0, C1, C2, … Cn are defined by the formula − $$c_{n}=\frac{1}{n+1}\binom{2n}{n} = \frac{2n!}{(n+1)!n!}$$ The first few Catalan numbers for n = 0, 1, 2, 3, … are 1, 1, 2, 5, 14, 42, 132, 429, 1430, 4862, … Syntax unsigned long int catalan(unsigned int n); Applications of Catalan Numbers Counting the number ...

Read More

C Program that receives a number and prints it out in large size

Sunidhi Bansal
Sunidhi Bansal
Updated on 15-Mar-2026 475 Views

In C, we can create a program that displays numbers in large size using ASCII art patterns made with hash symbols. This technique is useful for creating visually appealing banner-style output or digital displays. Syntax void printLargeNumber(char number[]); Approach The solution uses predefined character arrays to store ASCII art patterns for each digit (0-9). Each digit pattern is 7 rows high and 8 characters wide − Define 2D character arrays for each digit's visual pattern Traverse the input string character by character Print corresponding patterns row by row to display digits side ...

Read More

C Program to check if a number belongs to a particular base or not

Sunidhi Bansal
Sunidhi Bansal
Updated on 15-Mar-2026 1K+ Views

Given a number as a string and a base, the task is to check whether the given number belongs to that given base or not. We have to check the number and the base according to the number system in which there are bases like 2 for a binary number, 8 for an octal number, 10 for decimal number and 16 for a Hexadecimal number. According to this we have to find whether the given number in a string belongs to a particular base or not. If it belongs to a particular base then we have to print "Yes" ...

Read More

C Program for N-th term of Arithmetic Progression series

Sunidhi Bansal
Sunidhi Bansal
Updated on 15-Mar-2026 9K+ Views

Given 'a' the first term, 'd' the common difference and 'n' for the number of terms in a series. The task is to find the nth term of the Arithmetic Progression series. Arithmetic Progression (AP) is a sequence of numbers where the difference between any two consecutive terms is constant. This constant difference is called the common difference. For example, if we have first term a = 5, common difference d = 2, and we want to find the 4th term, the series would be: 5, 7, 9, 11. So the 4th term is 11. Syntax ...

Read More
Showing 41–50 of 809 articles
« Prev 1 3 4 5 6 7 81 Next »
Advertisements