Skip to content
Snippets Groups Projects
Commit 0c910354 authored by Peter Gerwinski's avatar Peter Gerwinski
Browse files

Vorbereitung 26.10.2023

parent 091b9cba
Branches
No related tags found
No related merge requests found
#include "loesung-2.h"
int is_leap_year (int year)
{
if (year % 4 == 0)
if (year % 100 == 0)
if (year % 400 == 0)
return 1;
else
return 0;
else
return 1;
else
return 0;
}
int days_in_month (int month, int year)
{
if (month == 2)
if (is_leap_year (year))
return 29;
else
return 28;
else if (month == 4 || month == 6 || month == 9 || month == 11)
return 30;
else
return 31;
}
void date_print (date *d)
{
printf ("%02d.%02d.%04d", d->day, d->month, d->year);
}
int date_set (date *d, char day, char month, int year)
{
d->year = year;
if (month > 0 && month <= 12)
d->month = month;
else
return 0;
if (day > 0 && day <= days_in_month (month, year))
d->day = day;
else
return 0;
return 1;
}
void date_next (date *d)
{
d->day++;
if (d->day > days_in_month (d->month, d->year))
{
d->month++;
d->day = 1;
if (d->month > 12)
{
d->year++;
d->month = 1;
}
}
}
#include <stdio.h>
typedef struct
{
char day, month;
int year;
}
date;
extern int is_leap_year (int year);
extern int days_in_month (int month, int year);
extern void date_print (date *d);
extern int date_set (date *d, char day, char month, int year);
extern void date_next (date *d);
#include <stdio.h>
int main (void)
{
int n, i, divisors;
for (n = 0; n < 100; n++)
divisors = 0;
for (i = 0; i < n; i++)
if (n % i == 0)
divisors++;
if (divisors == 2)
printf ("%d ist eine Primzahl.\n", n);
return 0;
}
#include <stdio.h>
int main (void)
{
int n, i, divisors;
for (n = 0; n < 100; n++)
divisors = 0;
for (i = 1; i < n; i++)
if (n % i == 0)
divisors++;
if (divisors == 2)
printf ("%d ist eine Primzahl.\n", n);
return 0;
}
#include <stdio.h>
int main (void)
{
int n, i, divisors;
for (n = 0; n < 100; n++)
{
divisors = 0;
for (i = 1; i < n; i++)
if (n % i == 0)
divisors++;
if (divisors == 2)
printf ("%d ist eine Primzahl.\n", n);
}
return 0;
}
#include <stdio.h>
int main (void)
{
int n, i, divisors;
for (n = 0; n < 100; n++)
{
divisors = 0;
for (i = 1; i <= n; i++)
if (n % i == 0)
divisors++;
if (divisors == 2)
printf ("%d ist eine Primzahl.\n", n);
}
return 0;
}
../common/logo-hochschule-bochum-cvh-text-v2.pdf
\ No newline at end of file
../common/logo-hochschule-bochum.pdf
\ No newline at end of file
Vor langer, langer Zeit
gab es einmal
#include "hexe.h"
Die lebte in einem Wald.
../common/pgscript.sty
\ No newline at end of file
../common/pgslides.sty
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment