Sunidhi Bansal

Sunidhi Bansal

809 Articles Published

Articles by Sunidhi Bansal

Page 79 of 81

Print pyramid of tutorialspoint in PL/SQL

Sunidhi Bansal
Sunidhi Bansal
Updated on 09-Aug-2019 982 Views

PL/SQL stands for “Procedural Language extension to SQL” . It is the mixture of SQL and Procedural features provided by programming language. It was developed by Oracle Corporation in the late 1980s as procedural extension language for SQL and the Oracle relational database.PL/SQL programs consists of blocks that can be nested and a block structure look likes this −DECLARE    -- it contains declaration statements BEGIN    -- It contains executable statements EXCEPTIONS    -- It contains exception handling statements END;ExampleIn PL/SQL single-line comments begin with double hyphen(--) and Multi-line comments begin with a slash-asterisk ( /* ) and end ...

Read More

Print the string after the specified character has occurred given no. of times in C Program

Sunidhi Bansal
Sunidhi Bansal
Updated on 08-Aug-2019 785 Views

Task is to print the given after the specified character occurrence for given number of times which is specified by the userInput : string = {“I am harsh vaid “}    Char =’a’    Count =2 Output : rsh vaidIt means user specified character ‘a’ and its occurrence 2 so the output string should be displayed after two occurrences of a.AlgorithmSTART Step 1 -> input character in ch(e.g. ‘a’) and count(e.g. 2) as int Step 2 -> declare and initialize n with size of a string by sizeof(string)/sizeof(string[0]) Step 3 - > Loop For i to 0 and i 0 ...

Read More

C Program for Print the pattern by using one loop

Sunidhi Bansal
Sunidhi Bansal
Updated on 08-Aug-2019 4K+ Views

The challenge is to display the pattern using one loop only and with continue statement.AlgorithSTART Step 1 -> declare start variables i and j to 0 with number of rows in n to 6 Step 2 -> Loop For i=1 and i

Read More

Print longest palindrome word in a sentence in C Program

Sunidhi Bansal
Sunidhi Bansal
Updated on 08-Aug-2019 1K+ Views

Given a sentence and the challenge is to find the longest palindrome from the given sentenceWhat is a Palindrome?Palindrome is a word or sequence whose meaning remains same even after reversing the stringExample − Nitin, after reversing the string its meaning remains the same.Challenge is to find the longest palindrome from the given sentence.Like sentence is: malayalam liemadameil ijiIt contains three palindrome words but the longest is − liemadameilAlgorithmSTART STEP 1 -> Declare start variables I, j, k, l, max to 0, index to -1, check to 0, count to 0 Step 2 -> Loop For i to 0 and ...

Read More

Print n 0s and m 1s such that no two 0s and no three 1s are together in C Program

Sunidhi Bansal
Sunidhi Bansal
Updated on 08-Aug-2019 267 Views

There should be sequence of N 0’s and M 1’s such that the sequence so formed shouldn’t contain two consecutive 0’s with three consecutive 1’s.Input − N=5 M=9Output − 1 1 0 1 1 0 1 1 0 1 0 1 0 1Note − To make the above sequence, the statement (m < n-1) || m >= 2 * (n + 1) should be false if it is true than we can’t make the above sequence.It is advisable to first go through question logic and try yourself instead of jumping to the solution directly given below.AlgorithmSTART Step 1 -> take values in ...

Read More

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

Sunidhi Bansal
Sunidhi Bansal
Updated on 08-Aug-2019 398 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 array of pointer char *alpha with values {"ZERO", "ONE", "TWO", "THREE", "FOUR", "FIVE", "SIX", "SEVEN", "EIGHT", "NINE"} Step 2 -> declare char array str[20] Step 3 -> call function itoa with parameters num, str, 10 Step 4 -> Loop For i=0 and str[i]!=’\o’ and i++    Print alpha[str[i] - '0'] ...

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 232 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 points.AlgorithmStart Step 1 -> Declare int variable n to 9 and k to 7 and remain to 1 and i Step 2-> Loop for i to 0 and i end Loop For StopExample#include int main() {    int n = 9, k = 7, remain=1, i ; // taking n ...

Read More

Print multiples of Unit Digit of Given Number in C Program

Sunidhi Bansal
Sunidhi Bansal
Updated on 08-Aug-2019 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 your’re given with a number N and you need to find its unit digit thatyou can use N%10 it will return you unit digit of number NALGORITHMSTART Step 1 -> Declare start variables num, num2 and i Step 2 -> input number num Step 3 -> store num%10 in num2 ...

Read More

Print n numbers such that their sum is a perfect square

Sunidhi Bansal
Sunidhi Bansal
Updated on 30-Jul-2019 206 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 till i printing (2*i)-1 Step       Step 2.2 -> incrementing i with 1 Step    Step3-> End loop While STOPExample#include # define SIZE 5 int main() {    int i=1;    while(i

Read More

Print number of words, vowels and frequency of each character

Sunidhi Bansal
Sunidhi Bansal
Updated on 30-Jul-2019 370 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    Total number of vowels : 4    Total number of words : 4AlgorithmSTART Step 1 Declare array of string, ch, i, freq to 0, vow to 0, word to 0 Step 2 Input a string and a character ch Step 3 Loop for from i to 0 and str[i]!=’\o’ ...

Read More
Showing 781–790 of 809 articles
Advertisements