Skip to content

Commit 9347084

Browse files
committed
[main] Added files
1 parent 0c6afd4 commit 9347084

File tree

26 files changed

+420
-0
lines changed

26 files changed

+420
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#include <stdlib.h>
2+
#include <limits.h>
3+
4+
#define MIN(x, y) x < y ? x : y
5+
#define MAX(x, y) x > y ? x : y
6+
7+
int *difference_in_ages(size_t a, const int ages[a])
8+
{
9+
int minAge = INT_MAX;
10+
int maxAge = INT_MIN;
11+
for (int i = 0; i < (int)a; i++)
12+
{
13+
minAge = MIN(ages[i], minAge);
14+
maxAge = MAX(ages[i], maxAge);
15+
}
16+
int *arr = malloc(sizeof(int) * 3);
17+
arr[0] = minAge;
18+
arr[1] = maxAge;
19+
arr[2] = maxAge - minAge;
20+
return arr;
21+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#include <ctype.h>
2+
#include <stdbool.h>
3+
4+
bool is_uppercase(const char *source)
5+
{
6+
int i = 0;
7+
while (source[i] != '\0')
8+
{
9+
if (!isupper(source[i]) && isalpha(source[i]))
10+
{
11+
return false;
12+
}
13+
i++;
14+
}
15+
return true;
16+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#include <string.h>
2+
3+
int correct_tail(const char *body, const char *tail)
4+
{
5+
return body[strlen(body) - 1] == tail[0];
6+
}

csharpProblems/Ball/Ball.csproj

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net6.0</TargetFramework>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
<Nullable>enable</Nullable>
8+
</PropertyGroup>
9+
10+
</Project>

csharpProblems/Ball/Program.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
using System;
2+
3+
public class Ball
4+
{
5+
public string ballType { get; set; }
6+
7+
public Ball(string ballType = "super")
8+
{
9+
this.ballType = ballType;
10+
}
11+
}
Binary file not shown.
Binary file not shown.
0 Bytes
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)