Skip to content

Commit 08e7c24

Browse files
committed
some necessary files to test the tasks
1 parent 5c4fc45 commit 08e7c24

File tree

14 files changed

+292
-0
lines changed

14 files changed

+292
-0
lines changed

0x02-functions_nested_loops/1-main.c

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#include "main.h"
2+
3+
/**
4+
* main - check the code
5+
*
6+
* Return: Always 0.
7+
*/
8+
int main(void)
9+
{
10+
print_alphabet();
11+
return (0);
12+
}

0x02-functions_nested_loops/10-main.c

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#include "main.h"
2+
#include <stdio.h>
3+
4+
/**
5+
* main - check the code
6+
*
7+
* Return: Always 0.
8+
*/
9+
int main(void)
10+
{
11+
int n;
12+
13+
n = add(89, 9);
14+
printf("%d\n", n);
15+
return (0);
16+
}
+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#include "main.h"
2+
3+
/**
4+
* main - check the code.
5+
*
6+
* Return: Always 0.
7+
*/
8+
int main(void)
9+
{
10+
print_times_table(3);
11+
_putchar('\n');
12+
print_times_table(5);
13+
_putchar('\n');
14+
print_times_table(98);
15+
_putchar('\n');
16+
print_times_table(12);
17+
return (0);
18+
}

0x02-functions_nested_loops/11-main.c

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#include "main.h"
2+
3+
/**
4+
* main - check the code
5+
*
6+
* Return: Always 0.
7+
*/
8+
int main(void)
9+
{
10+
print_to_98(0);
11+
print_to_98(98);
12+
print_to_98(111);
13+
print_to_98(81);
14+
print_to_98(-10);
15+
return (0);
16+
}

0x02-functions_nested_loops/2-main.c

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#include "main.h"
2+
3+
/**
4+
* main - check the code.
5+
*
6+
* Return: Always 0.
7+
*/
8+
int main(void)
9+
{
10+
print_alphabet_x10();
11+
return (0);
12+
}

0x02-functions_nested_loops/3-main.c

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#include "main.h"
2+
3+
/**
4+
* main - check the code.
5+
*
6+
* Return: Always 0.
7+
*/
8+
int main(void)
9+
{
10+
int r;
11+
12+
r = _islower('H');
13+
_putchar(r + '0');
14+
r = _islower('o');
15+
_putchar(r + '0');
16+
r = _islower(108);
17+
_putchar(r + '0');
18+
_putchar('\n');
19+
return (0);
20+
}

0x02-functions_nested_loops/4-main.c

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#include "main.h"
2+
3+
/**
4+
* main - check the code.
5+
*
6+
* Return: Always 0.
7+
*/
8+
int main(void)
9+
{
10+
int r;
11+
12+
r = _isalpha('H');
13+
_putchar(r + '0');
14+
r = _isalpha('o');
15+
_putchar(r + '0');
16+
r = _isalpha(108);
17+
_putchar(r + '0');
18+
r = _isalpha(';');
19+
_putchar(r + '0');
20+
_putchar('\n');
21+
return (0);
22+
}

0x02-functions_nested_loops/5-main.c

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#include "main.h"
2+
3+
/**
4+
* main - check the code.
5+
*
6+
* Return: Always 0.
7+
*/
8+
int main(void)
9+
{
10+
int r;
11+
12+
r = print_sign(98);
13+
_putchar(',');
14+
_putchar(' ');
15+
_putchar(r + '0');
16+
_putchar('\n');
17+
r = print_sign(0);
18+
_putchar(',');
19+
_putchar(' ');
20+
_putchar(r + '0');
21+
_putchar('\n');
22+
r = print_sign(0xff);
23+
_putchar(',');
24+
_putchar(' ');
25+
_putchar(r + '0');
26+
_putchar('\n');
27+
r = print_sign(-1);
28+
_putchar(',');
29+
_putchar(' ');
30+
_putchar(r + '0');
31+
_putchar('\n');
32+
return (0);
33+
}

0x02-functions_nested_loops/6-main.c

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#include "main.h"
2+
#include <stdio.h>
3+
4+
/**
5+
* main - check the code
6+
*
7+
* Return: Always 0.
8+
*/
9+
int main(void)
10+
{
11+
int r;
12+
13+
r = _abs(-1);
14+
printf("%d\n", r);
15+
r = _abs(0);
16+
printf("%d\n", r);
17+
r = _abs(1);
18+
printf("%d\n", r);
19+
r = _abs(-98);
20+
printf("%d\n", r);
21+
return (0);
22+
}

0x02-functions_nested_loops/7-main.c

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#include "main.h"
2+
3+
/**
4+
* main - check the code
5+
*
6+
* Return: Always 0.
7+
*/
8+
int main(void)
9+
{
10+
int r;
11+
12+
print_last_digit(98);
13+
print_last_digit(0);
14+
r = print_last_digit(-1024);
15+
_putchar('0' + r);
16+
_putchar('\n');
17+
return (0);
18+
}

0x02-functions_nested_loops/8-main.c

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#include "main.h"
2+
3+
/**
4+
* main - check the code
5+
*
6+
* Return: Always 0.
7+
*/
8+
int main(void)
9+
{
10+
jack_bauer();
11+
return (0);
12+
}

0x02-functions_nested_loops/9-main.c

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#include "main.h"
2+
3+
/**
4+
* main - check the code
5+
*
6+
* Return: Always 0.
7+
*/
8+
int main(void)
9+
{
10+
times_table();
11+
return (0);
12+
}

0x03-debugging/3-convert_day.c

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#include "main.h"
2+
3+
/**
4+
* convert_day - converts day of month to day of year, without accounting
5+
* for leap year
6+
* @month: month in number format
7+
* @day: day of month
8+
* Return: day of year
9+
*/
10+
11+
int convert_day(int month, int day)
12+
{
13+
switch (month)
14+
{
15+
case 2:
16+
day = 31 + day;
17+
break;
18+
case 3:
19+
day = 59 + day;
20+
break;
21+
case 4:
22+
day = 90 + day;
23+
break;
24+
case 5:
25+
day = 120 + day;
26+
break;
27+
case 6:
28+
day = 151 + day;
29+
break;
30+
case 7:
31+
day = 181 + day;
32+
break;
33+
case 8:
34+
day = 212 + day;
35+
break;
36+
case 9:
37+
day = 243 + day;
38+
break;
39+
case 10:
40+
day = 273 + day;
41+
break;
42+
case 11:
43+
day = 304 + day;
44+
break;
45+
case 12:
46+
day = 334 + day;
47+
break;
48+
default:
49+
break;
50+
}
51+
return (day);
52+
}

0x03-debugging/3-main_a.c

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#include <stdio.h>
2+
#include "main.h"
3+
4+
/**
5+
* main - takes a date and prints how many days are left in the year, taking
6+
* leap years into account
7+
* Return: 0
8+
*/
9+
10+
int main(void)
11+
{
12+
int month;
13+
int day;
14+
int year;
15+
16+
month = 2;
17+
day = 29;
18+
year = 2427;
19+
20+
printf("Date: %02d/%02d/%04d\n", month, day, year);
21+
22+
day = convert_day(month, day);
23+
24+
print_remaining_days(month, day, year);
25+
26+
return (0);
27+
}

0 commit comments

Comments
 (0)