1)#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#define number_t long
void numtoa (const number_t num, char *str)
{
sprintf(str, "%ld", num);
}
void main()
{
clrscr();
char string[11];
numtoa(2147483642, string);
printf("%s\n", string);
getchar();
}
2)#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#define number_t long*
void atonum (const char* str, number_t num)
{
*num = atol(str);
}
void main()
{
clrscr();
char string[11] = "2147483646";
long value = 0;
atonum(string, &value);
printf("%ld\n", value);
getchar();
}
3)#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
double fibonacci(int n)
{
n++;
double res = 0;
double a, b;
a = 0; b = 1;
if (n == 1 || n == 2) return n - 1;
for (int i = 3; i <= n; i++)
{
res = a + b;
a = b;
b = res;
}
return res;
}
void main()
{
clrscr();
for (int i = 1; i < 500; i++)
{
if (i % 100 == 0)
getchar();
printf("%.0lf, ", fibonacci(i));
}
getchar();
}
Задания в файле прикрепленном. Помогите пожалуйста!
