C Programming Code Examples
C > Functions Code Examples
print all natural numbers from 1 to n using recursion
Implement Pancake Sort Array of Integers -
C code implements Pancake Sort on array of integers. Pancake sorting is a variation of the "Sorting Problem" in which the only allowed operation is to reverse the elements of some
Use Ternary Operator (?:) C Programming -
The first expression conditionalExpression is evaluated first. This expression evaluates to 1 if it's true and evaluates to 0 if it's false. If the conditionalExpression is true, expression1 is
C++ Program Code Print Number Entered -
You'll learn to print the number entered by a user using C++ cout statement. This program asks user to enter a number. When enters an 'integer', it is stored in variable number using
Print Strong Numbers between an interval -
First give a meaningful name to our function, say "printStrongNumbers()". Along with this we must define function to find factorial of a number, say long long fact(int x);. Next we...
Displaying the Inventory of Items in Store -
C Program display the inventory of items in a store. accepts the value of item name, item code, price, quantity & manufacture date. Then display those value in a structured way.
Create an Array of Chars in C++ Language -
String is a "sequence of characters". char data type is used to represent one single character in C++. So if you want to use a String in your program then you can use an "array of chars".
C Diameter Circumference & Area of circle -
C Functions to find Diameter, Circumference and Area of circle. First assign a meaningful name to all the three functions. Say function to calculate diameter, circumference & area
C++ Programming Write Content to a File -
To 'write' some content in a file in C++, enter the file name with extension to open that file using the function open(), then after opening the desired file, again ask to the user to enter