Okay, we will be using for loop to create national flag of Nepal.
Actually, nested for loop.
If we use loop inside another loop, we called them as nested loop.
And finally, we have used sleep keyword to draw the flag in slow motion.
Have a look of output video here : video link
Alright, let's jump into the coding section.
//Creating National Flag of Nepal in C/C++
#include<stdio.h>
int main(){
int i,j;
for(i=1;i<=7;i++){
for(j=1;j<=i;j++){
printf(" * ");
sleep(1);
}
printf("\n");
}
for(i=1;i<=7;i++){
for(j=1;j<=i;j++){
printf(" * ");
sleep(1);
}
printf("\n");
}
for(j=1;j<=10;j++){
printf(" * \n");
sleep(1);
}
return 0;
}
Output:
---------
This much for now.
stay Positive ! stay Safe!
Thank you.
0 comments:
Post a Comment