Programming Articles

Page 963 of 2547

C Program for product of array

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

Given an array arr[n] of n number of elements, the task is to find the product of all the elements of that array. Like we have an array arr[7] of 7 elements so its product will be like − a[0] a[1] a[2] ... a[n-1] × × × × Product = a[0] × a[1] × a[2] × ... × a[n-1] ...

Read More

C Program for Arrow Star Pattern

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

In C programming, an arrow star pattern is a visual pattern that resembles an arrow shape using asterisk (*) characters. The pattern consists of two parts: an upper section that decreases in width and a lower section that increases in width, creating an arrow-like appearance. Syntax void printArrowPattern(int n); Algorithm The arrow pattern generation follows these steps − Upper Part: Print decreasing number of stars with increasing leading spaces Lower Part: Print increasing number of stars with decreasing leading spaces Use nested loops to control spaces and stars for each row ...

Read More

C Program to check if a number is divisible by sum of its digits

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

Given a number n we have to check whether the sum of its digits divide the number n or not. To find out we have to sum all the numbers starting from the unit place and then divide the number with the final sum. Like we have a number "521" so we have to find the sum of its digit that will be "5 + 2 + 1 = 8" but 521 is not divisible by 8 without leaving any remainder. Let's take another example "60" where "6+0 = 6" which can divide 60 and will not leave ...

Read More

C Program to check if the points are parallel to X axis or Y axis

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

Given n number of points we have to check that whether the point is parallel to x-axis or y-axis or no axis according to a graph. A graph is a figure which is used to show a relationship between two variables each measured along with axis at right angles. Parallel are the same lines which are having same distance at all points, like railway tracks are parallel to each other. So, we have to find whether the points are parallel to x-axis or y-axis means the distance between the coordinates and the axis are same at all points. ...

Read More

C Program for replacing one digit with other

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

Given a number n, we have to replace a digit x from that number with another given number m. We have to look for the number whether the digit is present in the given number or not, if it is present in the given number then replace that particular digit x with another digit m. Like we are given with a number "123" and m as 5 and the digit to be replaced i.e. x as "2", so the result should be "153". Syntax int digitReplace(int n, int digit, int replace); Algorithm The ...

Read More

C Program for Reversed String Pattern

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

In C programming, a reversed string pattern is a way to display a string in a triangular format where each row contains characters in reverse order, and when the string runs out, asterisks (*) fill the remaining positions. This creates an interesting visual pattern that grows row by row. Syntax void printReversedPattern(char str[], int length); Algorithm The approach to create this pattern involves the following steps − Start from the first row and print increasing number of characters For each row, calculate the starting position using formula: k = ((i*(i+1))/2)-1 Print characters ...

Read More

C Program to check if an Array is Palindrome or not

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

Given an array arr[] of any size n, our task is to find out whether the array is palindrome or not. A palindrome is a sequence which reads the same backwards and forwards, like: MADAM, NAMAN, etc. To check if an array is palindrome, we compare elements from both ends moving towards the center − 1 2 3 2 1 ...

Read More

C Program to check Plus Perfect Number

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

A Plus Perfect Number (also known as Armstrong Number or Narcissistic Number) is a number where the sum of its digits raised to the power of the number of digits equals the original number itself. Syntax int isPlusPerfect(int number); For example − 371: 3³ + 7³ + 1³ = 27 + 343 + 1 = 371 ✓ 163: 1³ + 6³ + 3³ = 1 + 216 + 27 = 244 ≠ 163 ✗ Plus Perfect Number Check: 371 ...

Read More

C Program to convert first character uppercase in a sentence

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

Given a string with mixed case letters, the task is to convert the first character of each word to uppercase and the rest to lowercase. This creates a proper title case format where each word begins with a capital letter. For example, given the string "hElLo world", we need to convert the first character 'h' to uppercase 'H' and make all other characters lowercase except for the first character after spaces, which should also be uppercase. Syntax void convertToTitleCase(char str[], int n); Example Input and Output Input: str[] = {"heLlO wORLD"} Output: ...

Read More

C Program to check if a date is valid or not

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

In C programming, validating a date requires checking multiple constraints including day, month, year ranges, leap years, and month-specific day limits. A valid date should range from 1/1/1800 to 31/12/9999. Syntax int datevalid(int day, int month, int year); int isleap(int year); Date Validation Constraints Date must be between 1 and 31 Month must be between 1 and 12 Year must be between 1800 and 9999 April, June, September, November have maximum 30 days February has 29 days in leap years, 28 days otherwise Example: Complete Date Validation This program implements ...

Read More
Showing 9621–9630 of 25,466 articles
« Prev 1 961 962 963 964 965 2547 Next »
Advertisements