- Node Js Tutorials
- Laravel Tutorials
- PHP Tutorials
- PHP E-commerce
- ZOHO CRM Tutorials
- Angularjs Tutorials
- Java Tutorials
- JavaScript Tutorials
- Wordpress Tutorials
- SEO Tutorials
- Python Tutorials
- MYSQL Tutorials
- Information Technology Industry News
- HR, Jobs and Career Tips
- ReactJS Tutorials
- How to crack
- C Program Examples

In this Program, User will enter the three sides of the triangle a, b, c. Then, Calculating the Perimeter of the Triangle. Moreover, calculating the semi perimeter using the formula (a + b + c) / 2 and calculating the Area of a triangle using Heron’s Formula: sqrt(s * (s - a) * (s - b) * (s - c)). After the successful execution of the program the final area of a triangle is shown on screen.

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.

To get the output of the this Program, User will Enter temperature in Celsius: 100 Then, Compiler will convert it into Fahrenheit automatically. The final output shown onto the screen is as follows: Enter temperature in Celsius: 100 100 Celsius = 212.00 Fahrenheit

In this program, User Enter a number and check whether the given number is even or odd. Then, after successful compilation displays to check it is Odd or Even on the screen. The output of this Program is given below:Enter any number to check it is even or odd: 4153 is Even.Enter any number to check it is even or odd: 33 is Odd.

This C program allows the user to enter the Principal Amount, Rate of Interest, and the Number of years. By using those values, this C Program will calculate the Simple Interest using following formula: Simple Interest = (Principal Amount * Rate of Interest * Number of years) / 100.

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.

This Program adds previous two numbers value to compute the next number value. In this program Fibonacci series is calculated using recursion, with seed as 0 and 1. In the code Fibonacci function calls itself with a lesser value several times. An termination condition is very important to recursion function, i.e. n == 0 and n == 1 or the recursive call would be infinite leading to stack overflow error.

. First of all I would like to explain what a natural number is? Then, I will demonstrate how to calculate the nth term of the natural number. Moreover, I would explain the logic to Find the Sum of First N Natural Numbers. Furthermore, I would write the logic and C Program to Find the Sum of First N Natural Numbers with output. Table of contents:What is Number? What is Natural Number? What is the formula to find the Sum of First N Natural Numbers? Demonstration to Find the Sum of First N Natural Numbers Logic to Find the Sum of First N Natural Numbers C Program to Find the Sum of First N Natural Numbers ConclusionWhat is Number? Number is an object that uses digits to perform mathematical tasks. Calculus that is a branch of mathematics included many numbers such as integers, whole numbers, real numbers, and imaginary numbers. Here, I will discuss numbers to perform arithmetic addition operations. Moreover, Number is a combination of digits, some symbols and decimal points. For instance, 127.23 is a rational number. There are many numbers such as whole numbers, natural numbers(positive integers), negative integers, rational numbers etc. What is Natural Number? Natural numbers are the numbers which are positive integers and include numbers from 1 till infinity(∞). These numbers are countable and are generally used for calculation purposes. The set of natural numbers is represented by the letter “N”. N = {1,2,3,4,5,6,7,8,9,10……,∞} What is the formula to find the Sum of First N Natural Numbers? Sums of the First n Natural Numbers The natural numbers are 1,2,3,4,... so on The sum of the first n natural numbers, Sn is as follows: 1 + 2 + 3 + 4 + ... + n Sn = 1 + 2 + 3 + 4 + ... + n As we know, that Sn=n[2a+(n−1)d]/2 According to 'n' natural numbers, The first term = a = 1 The common difference = d = 1 ∴ Sn=n[2×1+(n−1)×1]/2 Sn=n[2+n−1]/2 Sn=n[n+1]/2 Demonstration to Find the Sum of First N Natural Numbers Let's look at this problem for n=1, 2, 3, 4, and 5 and calculate the sum: 1=1 1+2=3 1+2+3=6 1+2+3+4=10 1+2+3+4+5=15 What is the formula to calculate this sum of n natural number ? The sum of n Natural numbers is calculated by using following formula: Logic to Find the Sum of First N Natural NumbersStep 1:Declare and initialize variable, i,num, s=0. Step 2:Enter the value of num i.e. number upto which sum is to be calculated Use Loop to add number. Step 3:Any of while, do-while or for loop can be used. Step 4:Print the sumC Program to Find the Sum of First N Natural Numbers #include <stdio.h> int main() { int n, count, sum = 0;printf("Enter the value of n(positive integer): "); scanf("%d",&n);for(count=1; count <= n; count++) { sum = sum + count; }printf("Sum of first %d natural numbers is: %d",n, sum);return 0; }The output of the Program with code: When the above code is executed, it produces the following results: Enter the value of n(positive integer): 6 Sum of first 6 natural numbers is: 21Conclusion: This C program to add first N natural numbers includes a single header file: stdio.h to control standard input and output function. As the program is executed, it asks for the value of the number to which the sum of natural numbers is to be found out. Then, the numbers are added using for loop. It can also be done with for and while loop as well. Finally, it displays the sum of numbers stored in integer variable ‘s’....

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).

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

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.

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.

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.

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.

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.

hello

Never Miss an Articles from us.

- Common Interview Questions
- Python Flask Interview Questions
- NoSQL interview questions
- JQuery Interview Questions
- C programming interview questions
- AngularJS Interview Questions
- Node JS Interview Questions with Express
- JavaScript Interview Questions
- Core Java interview questions
- HTML Interview Questions
- Laravel Interview Questions
- Wordpress Interview Questions
- PHP Interview Questions

Contribute the Community.