c programming examples with output

Pascal Triangle Program in C

Pascal triangle is a triangular array of binomial coefficients. In pascal’s triangle, each number is the sum of the two numbers directly above it. Here we will write a pascal triangle program in the C programming language. Pascal Triangle Program in C Without Using Array Output for different test-cases:- Enter the number of rows: 5 […]

Pascal Triangle Program in C Read More »

Floyd’s Triangle in C

Program to display Floyd’s triangle pattern in C language. There are many programming exercises in the C programming language which involve printing a particular pattern in the console. Floyd’s triangle is one of them. It is based on displaying a pattern of half a pyramid of numbers. Floyd’s triangle is a right angle triangle of

Floyd’s Triangle in C Read More »

Sum of N Natural Numbers in C

Write a C program to find the sum of N natural numbers in C using for loop, while loop, do-while loop, and without loop. Prerequisites:- While loop in C, Do-while loop in C, Difference between while and do-while, For loop in C Sum of natural number N as given as sum = 1+2+3+….+N Examples:- 1+2+3+4+5

Sum of N Natural Numbers in C Read More »

Absolute value in C

Absolute value describes the distance of a number on the number line from 0 without considering the direction. The absolute value of a number is always positive (distance can never be negative). Here we will develop a program to find the absolute value in C. First, we will develop a program without using any pre-defined

Absolute value in C Read More »