Quite often we need to print the current date and time from our program. For example, when we write log messages, we generally attach the timestamp with every message. Here we’ll see how to write a C program to print the current date and time. The time() function returns the number of seconds elapsed since … Continue reading “C Program to Print Current Date and Time”
Tag: C Programming
C Program to Calculate Factorial of a Number
Factorial of a number N, (N!) is 1*2*3*4*5*…..*N. Here we’ll see how to write C program to calculate the factorial value of a number. Here are the C functions that calculate the factorial value of a the input number. Using FOR Loop Using WHILE Loop Using Recursion Complete Program Any one of the above functions … Continue reading “C Program to Calculate Factorial of a Number”
C Program to Find Minimum and Maximum Numbers in an Array
Here we’ll see how to write C program to find the minimum and maximum numbers in an array. Here we assigned the first element of the array to both minimum (min) and maximum (max). Then we traverse the array from the second element to the last element. If any element is smaller than the current … Continue reading “C Program to Find Minimum and Maximum Numbers in an Array”
C Program to Print Fibonacci Series
Fibonacci series is a series of numbers where each number is the summation of two previous numbers. The first two numbers of Fibonacci series are 0 and 1. Here is an example of Fibonacci series: 0 1 1 2 3 5 8 13 21 34 55 89 144 233 377. Loop Version The function, print_fibonacci_series(), … Continue reading “C Program to Print Fibonacci Series”
C Program to Check Whether a Number is Palindrome
Palindrome number reads the same from both directions, forward and backward. For example, “156434651” reads the same from both directions. If we reverse a palindrome number, the reversed number would be the same as the original one. Here we’ll see how to write a C program to check whether a number is a palindrome. Method … Continue reading “C Program to Check Whether a Number is Palindrome”