Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Server Side Programming Articles
Page 944 of 2109
MCQ on Memory allocation and compilation process in C
Here we will see some MCQ questions on Memory Allocation and Compilation Processes in C programming language. Question 1: Union Memory Allocation What will be the output of the following code − #include #include int main() { union my_union { int i; float f; char c; }; union my_union* u; u = (union ...
Read MoreC Program to check if a number is divisible by any of its digits
Given a number n, the task is to find if any digit in the number divides the number completely. For example, the number 128625 is divisible by 5, which is also present in the number. Syntax int isDivisibleByDigit(long long int n); Algorithm The approach used is as follows − Extract each digit from the number using modulo operation Check if the original number is divisible by that digit If divisible, return true; otherwise continue with the next digit Remove the last digit by dividing the number by 10 Repeat until all digits ...
Read MoreC Program for product of array
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 MoreC Program for Arrow Star Pattern
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 MoreC Program to check if a number is divisible by sum of its digits
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 MoreC Program to check if the points are parallel to X axis or Y axis
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 MoreC Program for replacing one digit with other
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 MoreC Program for Reversed String Pattern
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 MoreC Program to check if an Array is Palindrome or not
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 MoreC Program to check Plus Perfect Number
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