Arnab Chakraborty has Published 4293 Articles

C program to find marks of students for boys or girls

Arnab Chakraborty

Arnab Chakraborty

Updated on 08-Oct-2021 11:04:55

975 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 ... Read More

C program to find nth term of given recurrence relation

Arnab Chakraborty

Arnab Chakraborty

Updated on 08-Oct-2021 11:02:52

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 ... Read More

C program to find sum of digits of a five digit number

Arnab Chakraborty

Arnab Chakraborty

Updated on 08-Oct-2021 11:00:17

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 ... Read More

C program to write all digits into words using for loop

Arnab Chakraborty

Arnab Chakraborty

Updated on 08-Oct-2021 10:58:16

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 ... Read More

C program to convert digit to words

Arnab Chakraborty

Arnab Chakraborty

Updated on 08-Oct-2021 10:56:42

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 = ... Read More

C program to find sum and difference using pointers in function

Arnab Chakraborty

Arnab Chakraborty

Updated on 08-Oct-2021 10:55:02

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 ... Read More

C program to find sum and difference of two numbers

Arnab Chakraborty

Arnab Chakraborty

Updated on 08-Oct-2021 10:50:57

6K+ Views

Suppose we have two integer numbers a, b and two floating point numbers c, d. We shall have to find the sum of a and b as well as c and d. We also have to find the sum of a and c as well. So depending on the printf ... Read More

C Program to read and write character string and sentence

Arnab Chakraborty

Arnab Chakraborty

Updated on 08-Oct-2021 10:48:36

25K+ Views

Suppose you want to take a character, then a string and a sentence (string with spaces) using C. So we shall provide three inputs and print the same as output. The maximum size of the string is 500 here.So, if the input is likecharacter = 'T' string = "ProgrammingLanguage" sentence ... Read More

Program to find largest color value in a directed graph in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 08-Oct-2021 08:46:08

331 Views

Suppose we have a directed graph with n colored nodes and m different edges. And the nodes are numbered from 0 to n-1. We have a string col with lowercase letters, where col[i] represents the color of the ith node in this graph (0-indexed). We also have an edge list ... Read More

Program to find minimum interval to include each query in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 08-Oct-2021 08:42:27

381 Views

Suppose we have a list of intervals, where intervals[i] has a pair (left_i, right_i) represents the ith interval starting at left_i and ending at right_i (both inclusive). We also have another array called queries. The answer to the jth query is the size of the smallest interval i such that ... Read More

Advertisements