Blog : Online Interview Questions

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 factorial of a Number using Recursion
C Program to find factorial of a Number using Recursion

Program execution will start from the beginning of the main() function. The main function consists of fact() recursive function, this fact() function is called from main() function with user entered number n as an argument. After passing number 5 to the fact() function will call fact() function (recursive call). In recursive call, the value of that passed argument ‘n’ is decreased by 1 until n value reaches less than 1. The fact(0) will always 1. Once n value is less than one, there is no recursive call and the factorial program will calculate and print output. Your C compiler asks you to enter a number to find factorial as follows:Enter a positive number: 5After you enter your number, the program will be executed and give output like below:Factorial of 5 = 120

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.

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 Check Whether a Character is Vowel or Consonant
C Program to Check Whether a Character is Vowel or Consonant

In this Program, the if…else statement is used to check whether an alphabet entered by the user is a vowel or a constant. The five letters A, E, I, O and U are called vowels. All other letters except these 5 vowel letters are called consonants. This program assumes that the user will always enter an alphabetic character.

C Program Examples
C Program to Check Whether a Character is an Alphabet or not
C Program to Check Whether a Character is an Alphabet or not

In this Program, the if…else statement is used to check whether a character entered by the user is alphabet or not? The alphabets A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, and Z are called Alphabet. All other characters except these 26 letters are not an Alphabet. If User entered any character rather than 26 Alphabet than a print like # is not an alphabet.

C Program Examples
C Program to Compute Quotient and Remainder
C Program to Compute Quotient and Remainder

This program evaluates and Compute Quotient and Remainder when an integer is divided by another integer. In this program, the user is asked to enter two integers (dividend and divisor) which are stored in variable dividend and divisor respectively. Finally, the quotient and remainder are displayed as output.

C Program Examples
C Program to Find ASCII Value of a Character
C Program to Find ASCII Value of a Character

This program evaluates The ASCII value of inserted character. In this program, the user is asked to enter 'A' character. The character is stored in variable a. When %d format string is used, 65 (the ASCII value of G) is displayed. When %c format string is used, 'A' itself is displayed.

C Program Examples
C Program to Count Number of Digits in an Integer
C Program to Count Number of Digits in an Integer

The internal execution of the program depends upon the entered Integer.After the successful compilation of the program, a message is displayed on the screen as Enter a number in whose digits you want to count.If you entered 436 then again a message displayed as The number of digits in above integer is : 3

C Program Examples
C Program to Find the Frequency of Characters in a String
C Program to Find the Frequency of Characters in a String

As we know that time is the most important concern in our life. To do any task easily, We have to use software to perform it in a simpler manner. Software is a set of programs with related documents. The Software Program or Program is a set of instructions to do a specific task.

C Program Examples
C Program to Concatenate Two Strings
C Program to Concatenate Two Strings

The internal working of this program depends upon the length of the strings.After the successful compilation of the program, a message is displayed on the screen as Enter first string: User Enter Welcome Then, again a message displayed Enter second string: If second time user entered User then the final output is Concatenated string is WelcomeUser.

C Program Examples
C Program to Check Whether a Number is Positive or Negative
C Program to Check Whether a Number is Positive or Negative

The internal execution of the program depends upon the entered Integer.After the successful compilation of the program, a message is displayed on the screen as Enter a number: if user entered 6 then compiler checks that 6 is greater than 0 therefore it is a positive number not negative or 0 therefore, again a message displayed on the screen as You entered a positive number.

C Program Examples
C Program to Find Transpose of a Matrix
C Program to Find Transpose of a Matrix

This Program computes the transpose of the matrix and prints it on the screen as simply interchange the rows and columns of the matrix.

C Program Examples
C program to read a file
C program to read a file

The working mechanism of this source code is similar to above source code. But, it uses the function fopen() to open the file.txt file in reading mode i.e. function is called with “file.txt” and “r” as argument. After the file is opened in reading mode, the content of file.txt is displayed on the screen and file is closed.

Java Tutorials
An Introduction Java Object Oriented Programming Paradigm
An Introduction Java Object Oriented Programming Paradigm

Java object-oriented programming paradigm is far different from C++ and other languages. There was a time when sequential and straightway programming languages like C, Assembly Language, and Basic seemed to be easy to program, and rather difficult to design. Next came the age when Object Oriented Programming rolled over the computers, making it even easier not only in programming but also in designing and arranging data.

Write For Us.

Contribute the Community.