C Examples
The best way to learn C programming is by practicing lots of example programs.
The program uses recursion to reverse an input number. A function is recursively called to extract each digit from the number and place it in reverse order. The final output is a reversed number. We wrote the program using Dev C++ version 4.9.9.2 on a Windows 7 64-bit system. You must be familiar with following …
The program to identify a quadrilateral read inputs – length of sides and angles made by the quadrilateral shape and prints the shape name as output. We compiled the program using Dev-C++ compiler installed on a windows 7 64-bit system. You may try another standard C compiler, but make sure to modify the code according …
With the law of sine, you can find any unknown angle of a given triangle or the length of a particular side of a triangle or the length of a particular side of a triangle. This is a fundamental concept of trigonometry. We used Dev-C++ to compile the program, but you may use any other …
Previous Next A stack is an abstract data structure where elements are pushed and deleted from only one end. We call this top of a stack. This program implement stack using a linked-list structure. The linked-list is a linear list in which you can enter data only from one end. You must always insert from …
This example program accepts two input numbers and performs an arithmetic operation such as addition, subtraction, division, multiplication and mod operation on them. The output is printed to the console. Learn following C programming concepts before trying this example on your computer. C Assignment Operators C Variables and Constants C Flow Control Structures C Functions …
Previous Next A stack is a common data structure used in many applications. It is an abstract data type defined not by its data type, but by its operations. Stack operations are critical to its implementation. We will create a C++ stack using linked-list in this article. This program demonstrates the implementation of a stack …
The program computes the area of triangle once he user enters input values for the triangle. The inputs for the triangle are the length of base and height of the triangle. We compiled this program using Dev-C++ compiler installed on Windows 7 PC. You can use any standard C compiler if you like, but make …
The C program to count the frequency of vowels, consonants and white spaces for a given word or a sentence is a string manipulation program. A C loop with conditions that checks the given input string and count the number of vowels, consonants, and white spaces. We compiled this program using Dev-C++ compiler installed on a …
The C program to display student results demonstrates the working of conditional statement in the C language. The program takes student’s marks in percentage (%) as input , process the input value and displays the results (pass or fail) as output. The output depends on the conditional statement in the example program. Learn C programming …