Found 1401 Articles for C

C Program to convert a given number to words

Sunidhi Bansal
Updated on 20-Nov-2019 10:45:22

11K+ Views

Given a string consisting of numerical values, the task is to covert those given numbers in words.Like we have an input “361”; then the output should be in words i.e, ” Three hundred sixty one”. For the solution of the following problem we have to keep in mind the numbers and places it is in on like ones, tens, thousands etc.The code only support upto 4 digits numbers i.e., 0 to 9999. So the input should be from 0 to 9999.Let us consider 1, 111 so the places will be like −ExampleInput: “1234” Output: one thousand two hundred thirty four ... Read More

Printing all subsets of {1,2,3,…n} without using array or loop in C program

Sunidhi Bansal
Updated on 20-Nov-2019 10:27:55

833 Views

Given a positive integer n we have to print all the subsets of a set of {1, 2, 3, 4, … n} without using any array or loops.Like we have given any number say 3 s we have to print all the subset in the set {1, 2, 3} which would be {1 2 3}, {1 2}, {2 3}, {1 3}, {1}, {2}, {3} { }.But we have to do this without using any loop or an array. So, only the recursion is the possible way to solve this type of problem without using any array or a loop.ExampleInput: 3 ... Read More

Program to Convert Hexadecimal to Octal in C program

Sunidhi Bansal
Updated on 20-Nov-2019 10:05:51

1K+ Views

We are given a Hexadecimal number as string; the task is to convert it to the Octal. To convert a hexadecimal number to octal, we have to −Find the binary equivalent to the hexadecimal number.Convert the binary number to Octal.What are hexadecimal numbersHexadecimal numbers are the numbers which are of base of 16 the numbers vary from 0-9 and from 10 onwards the numbers are represented as A which represents 10, B for 11, C for 12, D for 13, E for 14, and F for 15.To convert hexadecimal number into binary number every number is converted into its binary ... Read More

Bash program to check if the Number is a Prime or not

sudhir sharma
Updated on 13-Nov-2019 11:53:01

18K+ Views

Bash also known as GNU bash is a command language and unix shell script is a command line interpreter for operating system. It was designed by Brian Fox and was a free software which replaced Bourne shell. It first released in 1989 and some became go to for login shell for linux based operating systems like macOS, Linux based softwares, etc.Prime number is a number that has only two factors i.e. the number itself and 1. For example, 2 , 3 , 5, 7 , 11 , 13 , 17 , 19 , 23 , 29….Here we are given a ... Read More

bar() function in C graphics

sudhir sharma
Updated on 13-Nov-2019 11:47:23

2K+ Views

bar() function is a C graphics function that is used to draw graphics in the C programming language. The graphics.h header contains functions that work for drawing graphics. The bar() function is also defined in the header file.Syntaxvoid bar(int left, int top, int right, int bottom );The bar() function is used to draw a bar ( of bar graph) which is a 2-dimensional figure. It is filled rectangular figure. The function takes four arguments that are the coordinates of (X, Y) coordinates of the top-left corner of the bar {left and top } and (X, Y) coordinates of the bottom-right ... Read More

Bands in Radio frequency Spectrum in C program

sudhir sharma
Updated on 13-Nov-2019 11:43:05

428 Views

Radio frequency (RF) is the oscillation of an A.C. current or an A.C. voltage or any other oscillating body in the frequency range of 20KHz to 300 GHz.Radio frequency spectrum of a device is the frequency range that the device can capture, process or repercate. Generally the frequency range is 20Hz to 20KHz.A band is a frequency range that is divided from very low frequency to extremely high frequency. These bands are small ranges of frequency that are used to provide small parts of the spectrum.Bands In Radio Frequency SpectrumFrequency Range is range of continuous that has an upper limit ... Read More

Introduction to Backtracking

sudhir sharma
Updated on 02-Nov-2023 00:22:40

27K+ Views

Backtracking is a technique based on algorithm to solve problem. It uses recursive calling to find the solution by building a solution step by step increasing values with time. It removes the solutions that doesn't give rise to the solution of the problem based on the constraints given to solve the problem.Backtracking algorithm is applied to some specific types of problems, Decision problem used to find a feasible solution of the problem.Optimisation problem used to find the best solution that can be applied.Enumeration problem used to find the set of all feasible solutions of the problem.In backtracking problem, the algorithm ... Read More

Array Representation Of Binary Heap

sudhir sharma
Updated on 13-Nov-2019 10:20:04

3K+ Views

The complete binary tree that follows the properties of heap ordering is called binary heap.Based on the ordering of binary heap, it can be of two types −min Heap is the heap in which the value of node is greater than or equal to the value of its parent node. The root node of min heap is smallest.max Heap is the heap in which the value of node is smaller than or equal to the value of its parent node. The root node of max heap is greatest.The values of binary heap is typically represented as an array. The array ... Read More

Assigning an integer to float and comparison in C/C++

sudhir sharma
Updated on 24-Oct-2019 10:41:40

2K+ Views

The integer is a data type used to define a number that contains all positive, negative or zero non-fractional values. These cannot have decimals.Float is a data type used to define a number that has a fractional value. These can have decimals also.Now, we will check what will be the value of float and integer return by the compiler when we input the same value for both.Example Live Demo#include using namespace std; int main(){    float f = 23;    unsigned int x = 23;    cout

Arrays in C/C++ program

sudhir sharma
Updated on 24-Oct-2019 08:44:50

904 Views

The array is a collection of a fixed number of items of the same data type. These elements are stored in contiguous memory locations in the memory.Every single element of the value can be accessed from its index value using the brackets “[]” and the array name like a[4], a[3], etc.Declaring ArraysIn c/c++ programming languages, arrays are declared by defining the type and length (number of elements) of the array. The below syntax show declaration of an array in c/c++ −data_tpye array_name[length];For example, declaring an array of type float named the percentage of length 10.float percentage[10]Initializing array valuesIn c++ programming ... Read More

Advertisements