
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 33676 Articles for Programming

295 Views
In this problem, we have to create a program that does not terminate when ctrl+C is pressed. Instead, it prints“Ctrl + C cannot terminate the program”.For this, we can use signal handling. The signal SIGINT is created on pressing ctrl+c. To solve this problem, we will catch this signal and handle it.Program to show the implementation of our solution,Example#include #include void signalHandle(int sig_num) { signal(SIGINT, signalHandle); printf(" Ctrl + C cannot terminate the program"); fflush(stdout); } int main (){ signal(SIGINT, signalHandle); while(!0) return 0; }OutputCtrl + C cannot terminate the program

266 Views
In this problem, we are given a number and our task is to check if the number is Woodall number or not.Woodall number is a special type of number which is of the form, Wn = n.2n -1First 5 Woodall numbers are 1, 7, 23, 63, 159Let’s take an example to understand the problem, InputX = 159OutputYesTo solve this problem, we will observe the number, if the number is even then it cannot be Woodall and then check for the number. To check, add the number by 1 and recursively divide the number by 2. after each division count the ... Read More

227 Views
In this problem, we are given a dictionary and a word. Our task is to check if the given wors can be formed using the concatenation of two dictionary words.While forming given words repetition of words is not legal.Let’s take an example to understand the problem, Inputdictionary = {“hello”, “tutorials”, “program” , “problem”, “coding”, “point”} word = “tutorialspoint”OutputyesExplanationtutorialspoint is created using tutorials and point.To solve this problem, we will store all elements of the dictionary in a prefix tree commonly known as a trie. And then search for the prefix of the word in the trie, if found split it ... Read More

325 Views
In this problem, we are given a dictionary and two words ‘start’ and ‘target’. Our task is to generate a chain (ladder) from start work to target word, the chain is created such that each word differs the other character by only one word and the word should also exist in the dictionary. The target word exists in the dictionary and also the length of all words is the same. The program will return the length of the shortest path from start to target.Let’s take an example to understand the problem, InputDictionary = {‘HEAL’, ‘HATE’, ‘HEAT’, ‘TEAT’, ‘THAT’, ‘WHAT’ , ... Read More

390 Views
Array and vectors are very important data structures in competitive programming for solving problems. And the STL (Standard Template Library) in c++ programming provide some functions to perform operations of arrays and vectors.Let’s see some of these functions in action, Finding sum, Min and Max of the array/vector − In STL there are function that helps you to find the sum, max, and min of the array/vector. Functions with there function, Finding sumaccumulate(startIndex, endIndex, initialSum)Greatest element of the array/vecto*max_element(startIndex, endIndex)Smallest element of array/vector*min_element(startIndex, endIndex)Program to perform operations on array −Example Live Demo#include using namespace std; int main(){ int array[] ... Read More

358 Views
In this program, we are given a file name text.txt. Our task is to print a particular line from the file.For this there are multiple methods in bash script, they are awk, sed, head.Syntax$> awk ‘{if(NR==LINE_NUMBER) print $0}’ filename $> sed -n LINE_NUMBERp filename $head -n LineNumber filename | tail - n + LINE_NUMBERCode to print a specific line in bash programming from file text.txt.Using awk$> awk ‘{if(NR==5) print $0}’ text.txtUsing sed$>sed -n 5p text.txtUsing head$head -n 5 filename | tail - n + 5

262 Views
Here, we will write a C program that will display the contents of a file page by page as displayed in Linux using the more command.This program will show a specific number of lines on the screen first and then wait for the user to hit enter to move to the next page i.e. next set of n lines.For displaying the content of the file like this we will open the file and print its contents. And maintain a counter for new lines in the file. When this counter reaches n, we will read a key pressed by the user ... Read More

234 Views
In this problem, we have to write a program that will print ‘Tutorials Point ’ without using a semicolon.We all know that to end a statement in c semicolon is necessary. And print statement will be executed when a semicolon is added at the end.So, for printing ‘Tutorials point’ without a semicolon, we will have to first learn about the printf method in c. in actually returns an integer which is the count of total number of characters that are required to be printed.Syntaxint printf(constant char *format, ...)The method can accept n number of arguments. The first will be the ... Read More
Write a C program to print ‘ABCD’ repeatedly without using loop, recursion and any control structure

247 Views
In this problem, we have to write a program in c that will print a string ‘ABCD’ repeatedly without using loop, recursion and any control structure.So, we will have to call or run the same block of code infinite time but without using loop, recursion or control structure which are the most common methods to perform the task. For this, we will run the same program multiple times instead of looping. This will perform our task within the given constraints. The system() method can be employed inside the code that will call the program infinite times.We will pass the file ... Read More

460 Views
In this problem, we are given a linked list. Our task is to create a function that will be able to count the number of times a given number occurs in the linked list.Let’s take an example to understand the problem, InputLinked list = 10-> 50 -> 10 -> 20 -> 100 -> 10, int = 10Output3Explaination − the number 10 occurs 3 times in the linked list.The solution to this problem is simple, just traverse the linked list and increment a counter the current node value is equal to the given number.The looping over the nodes of the linked ... Read More