print 100 times c
#include <stdio.h>
int main() {
int i;
for (i = 0; i < 100; i++) {
printf("c\n");
}
return 0;
}
Explanation:
- The code starts with the #include <stdio.h>
line, which includes the standard input/output library in C. This library provides functions like printf()
for printing output to the console.
- The main()
function is the entry point of the program. It has a return type of int
, indicating that it should return an integer value.
- Inside the main()
function, we declare an integer variable i
to use as a loop counter.
- The for
loop is used to repeat a block of code multiple times. In this case, the loop will execute as long as the condition i < 100
is true.
- Inside the loop, the printf()
function is called to print the character 'c' followed by a newline character '\n'. This will be repeated 100 times.
- After the loop, the return 0;
statement indicates that the program has finished executing and returns the value 0 to the operating system, indicating successful execution.
Please let me know if you need further assistance!