
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 1354 Articles for C

6K+ Views
Suppose we have few strings in an array. We shall have to find all permutations of them in different line.So, if the input is like strings = ["abc", "def", "ghi"], then the output will beabc def ghi abc ghi def def abc ghi def ghi abc ghi abc def ghi def abcTo solve this, we will follow these steps −Define a function next_permutation(), this will take n, string array s, for initialize i := n - 1, when i > 0, update (decrease i by 1), do:if s[i] > s[i - 1]), then:j := i + 1for j < n, ... Read More

5K+ Views
Suppose we have a string s. The s contains letters and digits both. We shall have to find frequencies of each digit and display them. To do this we can make an array of size 10 for each digits (0 through 9), initially all elements are 0 inside the array, then when we encounter a digit simply increase the value of that index and finally print them all.So, if the input is like s = "we85abc586wow236h69", then the output will be (Number 2, Freq 1) (Number 3, Freq 1) (Number 5, Freq 2) (Number 6, Freq 3) (Number 8, Freq ... Read More

3K+ Views
Suppose we have a string s that contains a sentence with few words. We shall have to print each word into new lines. To do this we can use the strtok() function under the string.h header file. This function takes the string and a delimiter. Here the delimiter is blank space " ".So, if the input is like s = "Let us see some string tokenizing fun", then the output will beLet us see some string tokenizing funTo solve this, we will follow these steps −token := first word by using strtok(s, " ") here delimiter is " "while token ... Read More

92K+ Views
Reversing an array means changing the order of its elements so that the first element becomes the last, the second becomes the second last, and so on. This operation is commonly used in applications such as data manipulation or algorithms that require elements to be in reverse order. For example, consider an array of integers: arr[] = {1, 2, 3, 4, 5} When the array is reversed, the first element (1) moves to the last position, the second element (2) becomes the second last, and so on. The reversed array will be: arr[] = {5, 4, 3, 2, 1} ... Read More

8K+ Views
Suppose we have a number n. We shall have to make an array of size n dynamically and take n numbers one by one, then find the sum. To make the array we can use malloc() or calloc() function which is present inside the stdlib.h header file. The value of n is also provided as input through stdin.So, if the input is like n = 6, and array elements 9, 8, 7, 2, 4, 3, then the output will be 33 because sum of 9 + 8 + 7 + 2 + 4 + 3 = 33.To solve this, we ... Read More

357 Views
Suppose there is a tunnel whose height is 41 and width is very large. We also have a list of boxes with length, width and height. A box can pass through the tunnel if its height is exactly less than tunnel height. We shall have to find amount of volume that are passed through the tunnel. The volume is length * width * height. So we have a number N, an 2D array with N rows and three columns.So, if the input is like N = 4 boxes = [[9, 5, 20], [3, 7, 15], [8, 15, 41], [6, 3, ... Read More

927 Views
Suppose we have an array called marks, where some marks are given, all even indices marks like marks[0], marks[2] and so on are holding marks of boys and all even indexed marks are holding for girls. We have another input called gender. The value of gender is either 'b' or 'g', when it is 'b' we shall have to return the sum of all boys, and when it is 'g' return sum of marks for all girls. (Size of array is N)So, if the input is like N = 9 marks = [8, 5, 2, 6, 7, 5, 9, 9, ... Read More

2K+ Views
Suppose we have three numbers a, b, c and a value n. We follow a recurrence formula S(n) −S(1) returns aS(2) returns bS(3) returns cS(n) returns S(n-1) + S(n-2) + S(n-3) for all n > 3.We shall have to find nth term by following this recurrence.So, if the input is like a = 5, b = 2, c = 3, n = 6, then the output will be 28 because −S(6) = S(5) + S(4) + S(3)S(5) = S(4) + S(3) + S(2)S(4) = S(3) + S(2) + S(1) = 3 + 2 + 5 = 10so now S(5) = ... Read More

30K+ Views
Suppose we have a five-digit number num. We shall have to find the sum of its digits. To do this we shall take out digits from right to left. Each time divide the number by 10 and the remainder will be the last digit and then update the number by its quotient (integer part only) and finally the number will be reduced to 0 at the end. So by summing up the digits we can get the final sum.So, if the input is like num = 58612, then the output will be 22 because 5 + 8 + 6 + ... Read More

1K+ Views
Suppose we have two digits a and b. We shall have to convert each digit into words and print them one by one. Printing digits into words means for a digit 5, it should print "Five".So, if the input is like a = 3, b = 8, then the output will beThreeFourFiveSixSevenEightTo solve this, we will follow these steps −Define a function solve(), this will take d, if d < 0 and d > 9, then:return ("Beyond range of 0 - 9")otherwise when d is same as 0, then:return ("Zero")otherwise when d is same as 1, then:return ("One")otherwise when d ... Read More