C: Roman Numeral converter

Roman numerals are characters of the alphabet that are used to represent integers as show in the table below:

Symbol
Value
I
1
V
5
X
10
L
50
C
100
D
500
M
1000

Each character in a Roman numeral stands for the corresponding value. IN the simplest case, the value of the Roman numeral as a whole is the sum of the individual character values given in the table. For example, the string "LXXXVII" denotes 50 + 10 + 10 + 10 + 5 + 1 + 1, or simply, 87.

C: Pyramid (for-loops)

In the previous post, I discussed about how to create a triangle using four for-loops. In this post, we will learn how to create a program which will print a pyramid using looping statements in C.

For this program, four variables will be declared as integers, let us name them as, i, j, k and n. Variable i is the counter variable for the outer loop. Variable j and k are counter variables for the inner loop, and variable n is the length of the two legs of the pyramid, where as the base of our pyramid, is 2n-1.

C: Right Triangle (For-loop)

One of the basic lessons we had in looping, was creating figures, such as a triangle. In this post, I will be discussing how to create a program which will print a right triangle using looping statements in C.

For this program, three variables will be declared as integers, let us name them as, i, jand n. Variable i is the counter variable for the outer loop. Variable j is the counter variable for the inner loop, and variable n is the length of each side of the triangle.