Sunidhi Bansal

Sunidhi Bansal

809 Articles Published

Articles by Sunidhi Bansal

Page 15 of 81

Print matrix in antispiral form

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

In C programming, printing a matrix in antispiral form means traversing the matrix in a spiral order (clockwise from outside to inside) and then displaying the elements in reverse order. This creates an "antispiral" pattern where we start from the center and work outward. Syntax // Using array to store spiral elements int spiral[n*n]; // Traverse in spiral order: right → down → left → up // Print in reverse order Algorithm The approach involves two main steps − Spiral Traversal: Traverse the matrix in spiral order (right → down → left ...

Read More

Print numbers in descending order along with their frequencies

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

Given an array of integer elements, the task is to arrange the elements in descending order and find their frequencies. This approach works when the input array is already sorted in ascending order. Input : arr[]={1, 1, 1, 2, 2, 2, 3, 3, 4, 5, 6, 7, 7} Output : 7 occurs: 2 6 occurs: 1 5 occurs: 1 4 occurs: 1 ...

Read More

Print prime numbers from 1 to N in reverse order

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

In this article, we will learn how to print prime numbers from 1 to N in reverse order. A prime number is a number greater than 1 that has no positive divisors other than 1 and itself. Our goal is to find all prime numbers in the given range from 1 to N and then print them in reverse order. For example, given N = 20, the prime numbers between 1 and 20 are: 2, 3, 5, 7, 11, 13, 17, 19. The output should be the prime numbers printed in reverse order: 19, 17, 13, 11, 7, 5, ...

Read More

Print first N terms of series (0.25, 0.5, 0.75, ...) in fraction representation

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

In C programming, printing a series like (0.25, 0.5, 0.75, ...) in fraction representation involves converting decimal values to their equivalent fractions. This series represents multiples of 0.25, which can be expressed as fractions with denominator 4. Syntax for (i = 0; i < n; i++) { // Calculate numerator and denominator // Print in fraction form: numerator/denominator } Algorithm START Step 1 → Declare variables: int num, den, i, n Step 2 → Input number in n Step 3 → Loop from i = ...

Read More

Print uncommon elements from two sorted arrays

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

Given two sorted arrays, we need to find and print all uncommon elements (elements that appear in one array but not in both). This problem uses a two-pointer technique to efficiently traverse both arrays simultaneously. Given : array1[] = {1, 4, 6, 9, 12} array2[] = {2, 4, 7, 8, 9, 10} Output : 1 2 6 7 8 10 12 Syntax void printUncommonElements(int arr1[], int n1, int arr2[], int n2); Algorithm Initialize two pointers i and j to traverse both arrays ...

Read More

Print missing elements that lie in range 0 – 99

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

In C programming, finding missing elements within a specific range is a common problem. Given an array of integers, we need to identify which numbers from 0 to 99 are missing and display them either as individual numbers or as ranges. Syntax bool flag[MAX] = { false }; for (i = 0; i < n; i++) { if (array[i] >= 0 && array[i] < 100) { flag[array[i]] = true; } } Algorithm Create a boolean array flag[100] ...

Read More

Print the given 3 string after modifying and concatenating

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

This program demonstrates how to modify multiple strings by replacing all characters with user−specified replacement characters, then concatenate the modified strings together. Syntax strlen(string) // Get string length strcat(dest, source) // Concatenate strings scanf("%s", string) // Read string input Algorithm START Step 1 → Declare three character arrays str1, str2, str3 and replacement characters ch1, ch2, ch3 Step 2 → Input the three strings and three replacement characters Step 3 → Replace all characters in str1 with ...

Read More

Print number of words, vowels and frequency of each character

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

In C programming, string analysis is a common task where we need to count words, vowels, and find the frequency of specific characters. This program demonstrates how to analyze a string by counting these different elements in a single pass. Syntax // String traversal for character analysis for(i = 0; str[i] != '\0'; i++) { // Character comparison and counting logic } Algorithm START Step 1: Declare string array, character variable, and counters (freq=0, vowels=0, words=0) Step 2: Input string and target character Step 3: Loop through each character ...

Read More

Print n numbers such that their sum is a perfect square

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

Given n numbers, we need to find n numbers whose sum is a perfect square. The solution uses the first n odd numbers, as the sum of first n odd numbers is always n². Input : 5 Output : 1 3 5 7 9 1+3+5+7+9=25 i.e (5)² Syntax for(i = 1; i

Read More

Count odd and even digits in a number in PL/SQL

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

We are given a positive integer of digits and the task is to calculate the count of odd and even digits in a number using PL/SQL. PL/SQL is a combination of SQL along with the procedural features of programming languages. It was developed by Oracle Corporation in the early 90's to enhance the capabilities of SQL. PL/SQL is one of three key programming languages embedded in the Oracle Database, along with SQL itself and Java. Input int number = 23146579 Output count of odd digits in a number are : 5 count of even digits in a number are : ...

Read More
Showing 141–150 of 809 articles
« Prev 1 13 14 15 16 17 81 Next »
Advertisements