Commit cf457619 by Gürcan Güleç

Fixed the styles and added a few comments

parent 901e8f6d
#include <stdio.h> #include <stdio.h>
int main () int main(void)
{ {
// declaring a variable
int countDown = 11; int countDown = 11;
// starting the loop
do do
{ {
countDown--; countDown--;
// printing out the value of countDown
printf("The value of countDown is %d\n", countDown); printf("The value of countDown is %d\n", countDown);
}while(countDown > 0); }while(countDown > 0);
return 0; return 0;
......
#include <stdio.h> #include <stdio.h>
int main () int main(void)
{ {
int sum = 0; int sum = 0;
for (int number = 0; number <= 10; number++) //Initialize for loop // starting the loop
for (int number = 0; number <= 10; number++)
{ {
printf("The value of number is %d\n", number); //Print out the value of i // printing out the value of number
printf("The value of number is %d\n", number);
// adding number's value to sum
sum = sum + number; sum = sum + number;
} }
// printing out the value of sum
printf("The sum of all the numbers is %d\n", sum); printf("The sum of all the numbers is %d\n", sum);
return 0; return 0;
} }
#include <stdio.h> #include <stdio.h>
int main () int main(void)
{ {
int number = 0; int number = 0;
while (number <= 10) while (number <= 10)
{ {
printf("A = %d\n", number); printf("A = %d\n", number);
// using if to decide which number to stop
if (number == 3) if (number == 3)
{ {
// printing out the thing I wanna print out :P
printf("Stopping here cuz my favorite number is %d\n", number); printf("Stopping here cuz my favorite number is %d\n", number);
// making it stop with break;
break; break;
} }
// increasing the value of number
number++; number++;
} }
return 0; return 0;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment