Skip to content

Commit

Permalink
format code
Browse files Browse the repository at this point in the history
Signed-off-by: 0x4248 <60709927+0x4248@users.noreply.github.com>
  • Loading branch information
0x4248 committed Dec 3, 2024
1 parent 639ec7b commit f94e2fe
Showing 1 changed file with 20 additions and 11 deletions.
31 changes: 20 additions & 11 deletions c/weird_loops/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* main.c
*
* Looping in a weird way
*
*
* COPYRIGHT NOTICE
* Copyright (C) 2024 0x4248 and contributors
* Redistribution and use in source and binary forms, with or without
Expand All @@ -17,43 +17,52 @@
#include <stdio.h>
#include <stdlib.h>

int jumps(){
int jumps()
{
int i = 0;
loop:
if (i < 10) {
loop:
if (i < 10)
{
printf("i = %d\n", i);
i++;
goto loop;
}
return 0;
}

int while_loop() {
int while_loop()
{
int i = 0;
while (i < 10) {
while (i < 10)
{
printf("i = %d\n", i);
i++;
}
return 0;
}

int normal_loop() {
for (int i = 0; i < 10; i++) {
int normal_loop()
{
for (int i = 0; i < 10; i++)
{
printf("i = %d\n", i);
}
return 0;
}

int do_while_loop() {
int do_while_loop()
{
int i = 0;
do {
do
{
printf("i = %d\n", i);
i++;
} while (i < 10);
return 0;
}

int main() {
int main()
{

printf("Normal loop\n");
normal_loop();
Expand Down

0 comments on commit f94e2fe

Please sign in to comment.