\(\begin{array}{c } * \\ *\\ *\\ *\end{array}\)
Write a program that reads a number and displays a star on each line.
Difficulty level
This exercise is mostly suitable for students
#include<stdio.h>
#include<conio.h>
void main()
{
int N, i;
do{
printf("Enter N: ");
scanf("%d",&N);
}while(N<=0);
for(i=0; i< N; i++)
printf("*\n");
getch();
}
Back to the list of exercises
Looking for a more challenging exercise, try this one !!
Sum of the first n terms of the harmonic series - iterative