Blog : Online Interview Questions

C Program Examples
C program to print prime numbers between 1-100
C program to print prime numbers between 1-100

This Program runs a loop from 2 to 100 and checks for each current number within range that it is prime or not. After the successful execution of the program it displays the list of all prime numbers from 2 to 100. As we know that 1 is not a prime number so we don't need to check it.

C Program Examples
C program to swap two numbers without using third variable
C program to swap two numbers without using third variable

This Program stores two integers one by one into the int datatype. After the successful swapping of numbers it will exchange the value of them at once or you can say that it assign a's value to b and b's value to a.

C Program Examples
C program string palindrome
C program string palindrome

In the successful compilation of the program, a message is displayed on the screen as Please! Enter a string to check if it's a palindrome:This program entered a string by user then store it into a variable after that found its reversed and store it in to another variable if both variables are same then we can say that inputed string is palindrome otherwise that is not a palindrome.

C Program Examples
C Program to Generate Fibonacci Series
C Program to Generate Fibonacci Series

In this Program, The first two elements are respectively started from 0 , 1, and the other numbers in the series are generated by adding the last two numbers of the series using looping. These numbers are stored in an array and printed as output.

C Program Examples
C program to get length of string
C program to get length of string

In this program, using a for loop, we have iterated over characters of the string from i = 0 to until '\0' (null character) is encountered. In each iteration, the value of i is increased by 1. When the loop ends, the length of the string will be stored in the i variable.

C Program Examples
C program to find area of circle
C program to find area of circle

A circle can be defined as a locus (a set of points in a particular position) of points that maintain equidistant from another point called the center. In this Program first of all User Enter the radius of the circle then it shows the area of the circle according to the given radius by using formula. Area is always squarely proportional to the radius.

C Program Examples
C program to find area of rectangle
C program to find area of rectangle

In this Program, User will enter the length and width of the rectangle into two variables length and width. Then, Calculating the Area of the rectangle using the formula Area = length × width. After the successful execution the final area of a rectangle is shown on screen.

C Program Examples
C program to find prime number
C program to find prime number

This Program stores an integer into the variable with int datatype. After it is used for the loop it checks all divisors between 2 and the number itself. Then, Compare it is divisible or not by any number rather than 1 and itself. At last If the user input 1 then it shows the 1 is a prime number. Next, If the user inter 23 then it displays 23 is a prime number and Display to enter another number.

C Program Examples
C program to check number is armstrong
C program to check number is armstrong

In this program, the number of digits of an integer is calculated first and stored in n. And, the pow() function is used to compute the power of individual digits in each iteration of the second for loop.

C Program Examples
C Program to Find the Area of Parallelogram
C Program to Find the Area of Parallelogram

This program first takes length of base and height form user using scanf () function and stores it in three floating point variables. Then it calculates the area of Parallelogram using the formula Area of parallelogram = base X height. Then, it prints the area of parallelogram on screen using printf () function.

C Program Examples
C Program to convert Decimal to Binary Number
C Program to convert Decimal to Binary Number

A Decimal Number is constructed with any digit from 0 to 9. For instance, 24 is a Decimal Number constructed from the digits 2 and 4. A Binary Number is constructed with digits 0 and 1. For instance, 11000 is a Binary Number constructed from the digits 1 and 0 which is the value of a Decimal Number 24. This Program will convert any Decimal number entered by the user to its equivalent Binary Number.

C Program Examples
C Program to find Power of a Number using Recursion
C Program to find Power of a Number using Recursion

In this Program, we will solve this problem using recursion. We will first take base and exponent as input from user and pass it to a recursive function, which will return the value of base raised to the power of exponent(base^exponent).

C Program Examples
C Program to find largest number among three numbers
C Program to find largest number among three numbers

In this program, three numbers are assigned in to the three variables one by one. Then, compare the two selected of them with the use of comparison operator. Repeat the same process for the other two. After the successful execution of the program the final largest number amongst the three are displayed on the screen.

C Program Examples
C program to find area of triangle given 3 sides
C program to find area of triangle given 3 sides

This Program accepts the three sides of the triangle a, b, c. Then, Calculates the Perimeter of the Triangle. Moreover, calculates the semi perimeter using the formula (a + b + c) / 2 and the Area of a triangle using Heron’s Formula: √(s × (s - a) × (s - b) × (s - c)). After the successful execution of the program the final area of a triangle is shown on screen.

C Program Examples
C Program to Find the Area of Rhombus
C Program to Find the Area of Rhombus

Above program first takes length of diagonals as input form user using scanf function and stores it in two floating point variables. Then it calculates the area of Rhombus using the formula given above. Then, it prints the area of Rhombus on screen using printf function.

Write For Us.

Contribute the Community.