Pages

Showing posts with label c program. Show all posts
Showing posts with label c program. Show all posts

Simple C Program to Calculate Sum of Digits of a Number

This is a very simple C Language program that calculates the sum of digits of a 5 digit number. The 5 digit number is entered by the user. Here's the code and output of the program. Enjoy!!!

Simple C Program to check if number is Even or Odd

This is a simple C programs which checks if a given number is even or odd. An even number is one that is completely divisible by 2 and an odd number is one which is not.


Simple C Language Program to Print Shapes

Printing shapes is a common task given to C Language students. It is a good way to capture the main concepts of looping. We'll discuss different methods to print shapes in C Language using looping. If you get these simple concepts well, then the rest becomes a smooth ride.
So, let's start with the show.

C Program to Find Factorial of a Number

This is a simple C language program to find factorial of any number. In case you don't know what factorial is, factorial is the product of an integer and all the integers below it. For example:
5! = 1 * 2 * 3 * 4 * 5 = 120
The program first prompts for any integer. Then, finds the factorial using For Loop and prints the result.