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”
Category: C
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”
C Program to Check Whether a String is Palindrome
Palindrome string is a string that reads the same from both forward and backward directions. For example, “madam” reads the same from both directions. If you reverse a palindrome string, the reversed string would be the same as the original one. Here we’ll see how to write C program to check whether a string is … Continue reading “C Program to Check Whether a String is Palindrome”
C Program to Reverse a String
Here we’ll see how to write a C program to reverse a string. Solution 1 The reverse_string() function takes the input string as input parameter and reverses that into the output string. The last character of the input string is set as the first character of the output string, second last character of the input … Continue reading “C Program to Reverse a String”
C Program to Reverse an Integer
Here we’ll see how to write C program to reverse an integer. The reverse_integer() function takes an integer like 5234569 and returns 9654325. Output: Logic: The reverse_integer() function takes the last digit of “in” by doing modulo operation by 10. For example, if in is 5234569, 5234569 % 10 would be the last digit 9. … Continue reading “C Program to Reverse an Integer”