Sunidhi Bansal has Published 1085 Articles

C Program for Print individual digits as words without using if or switch.

Sunidhi Bansal

Sunidhi Bansal

Updated on 08-Aug-2019 09:02:44

337 Views

Print the given numeric value as words. It’s easy to do with switch using cases from 0-9 but challenge is without using them.Input  − N=900Output − NINE ZERO ZEROIt is possible by creating array of pointers that contains 0-9 in words.AlgorithmSTART Step 1 -> declare int variables num, i and ... Read More

Print first k digits of 1/n where n is a positive integer in C Program

Sunidhi Bansal

Sunidhi Bansal

Updated on 08-Aug-2019 08:59:15

193 Views

Input number N such that 1/N will return the output generated as decimal specified till the limit.It is easy with Floating Point numbers but the challenge is without using them.Input − n=5 k=5Output − 20000It means if n=5 and k=5 than after dividing 1/5 the output should be displayed till 5 decimal ... Read More

Print multiples of Unit Digit of Given Number in C Program

Sunidhi Bansal

Sunidhi Bansal

Updated on 08-Aug-2019 08:50:18

5K+ Views

Input number N and fetch the unit digit of a given number and display the multiples of that number.Input − N=326Output − unit digit is 6 and its multiples are 2 and 3Note − Unit digit of any number can be fetched by calculating the %10 with that numberFor example − if ... Read More

Print n numbers such that their sum is a perfect square

Sunidhi Bansal

Sunidhi Bansal

Updated on 30-Jul-2019 22:30:26

180 Views

Given with n numbers program must find those n number whose sum is a perfect squareInput : 5 Output : 1 3 5 7 9 1+3+5+7+9=25 i.e (5)^2AlgorithmSTART    Step 1 : Declare a Macro for size let’s say of 5 and i to 1    Step 2: loop While ... Read More

Print number of words, vowels and frequency of each character

Sunidhi Bansal

Sunidhi Bansal

Updated on 30-Jul-2019 22:30:26

321 Views

Input a string and find the total number of words, vowels and frequency of a character enter by a userInput : enter s string : I love my MOM      Enter a charcter of which you want to find a frequency: M    Total frequency of M : 2 ... Read More

Print the given 3 string after modifying and concatenating

Sunidhi Bansal

Sunidhi Bansal

Updated on 30-Jul-2019 22:30:26

246 Views

Input three strings and replace each string with a character which user has entered and then display edited strings. After that, concatenate edited strings and display them.Input:    string 1 : tutorials replacement character for string 1 : x    String 2 : points replacement character for string 2 : ... Read More

Print elements that can be added to form a given sum

Sunidhi Bansal

Sunidhi Bansal

Updated on 30-Jul-2019 22:30:26

223 Views

Input number of elements user want to enters and than input the total value user want to calculate from the given list of elements.Input : N=5    Enter any 5 values : 3 1 6 5 7    Enter sum you want to check : 10 Output : 3 1 ... Read More

Print missing elements that lie in range 0 – 99

Sunidhi Bansal

Sunidhi Bansal

Updated on 30-Jul-2019 22:30:26

224 Views

It will display the missing values from the given set entered by the userGiven : array = {88, 105, 3, 2, 200, 0, 10}; Output : 1 4-9 11-87 89-99AlgorithmSTART STEP 1-> Take an array with elements, bool flag[MAX] to Fale, int i, j, n to size of array Step ... Read More

Print uncommon elements from two sorted arrays

Sunidhi Bansal

Sunidhi Bansal

Updated on 30-Jul-2019 22:30:26

2K+ Views

Given two sorted arrays and output should display their uncommon elementsGiven : array1[]= {1, 4, 6, 9, 12}    array2[]= {2, 4, 7, 8, 9, 10} Output : 1 2 6 7 8 10 12AlgorithmSTART Step 1 -> declare two arrays array1 and array2 with elements as int and variables ... Read More

Print first N terms of series (0.25, 0.5, 0.75, …) in fraction representation

Sunidhi Bansal

Sunidhi Bansal

Updated on 30-Jul-2019 22:30:26

194 Views

Input N which is equivalent to the number till where series should be printedInput : N=5 Output : 0 ¼ ½ ¾ 1AlgorithmSTART Step 1 -> declare start variables as int num , den, i, n Step 2 -> input number in n Step 3 -> Loop For from i ... Read More

Advertisements