Skip to content

Commit

Permalink
11-print_to_98.c
Browse files Browse the repository at this point in the history
  • Loading branch information
victorpreston committed Jun 20, 2023
1 parent d59300f commit a9f9212
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions 0x02-functions_nested_loops/11-print_to_98.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#include "main.h"
#include <stdio.h>
/**
* print_to_98 - prints all natural numbers from n to 98
*
* @n: starting point
*
* Return: returns nothing
*
*/
void print_to_98(int n)
{
if (n <= 98)
{
for (n = n; n <= 97; n++)
printf("%d, ", n);
}
else
for (n = n; n > 98; n--)
printf("%d, ", n);
printf("98\n");
}

0 comments on commit a9f9212

Please sign in to comment.