
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
Server Side Programming Articles - Page 878 of 2650

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

93K+ 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

400 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

987 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

31K+ 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

3K+ Views
Suppose we have a digit d, we shall have to convert it into words. So if d = 5, our output should be "Five". If we provide some d which is beyond the range of 0 and 9, it will return appropriate output.So, if the input is like d = 6, then the output will be "Six".To 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 ... Read More

7K+ Views
Suppose we have two numbers a and b. We shall have to define a function that can calculate (a + b) and (a - b) both. But using a function in C, we can return at most one value. To find more than one output, we can use output parameters into function arguments using pointers. Here in this problem we shall update a with a+b and b with a-b. When we call the function we shall have to pass the address of these two variables.So, if the input is like a = 5, b = 8, then the output will ... Read More