Aktualizovat „du3/program.c“

This commit is contained in:
Bohdan Yanchyk 2020-03-26 20:05:21 +00:00
parent d7319a7e5c
commit 300898b676

View File

@ -1,30 +1,26 @@
#define _XOPEN_SOURCE
#include <stdio.h>
#include<ctype.h>
#include<math.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
int main()
{
float x=0;
float value =0;
int count =0;
float arr[50];
while(scanf("%f",&value)!=EOF){
if(isalpha(value)!=0){
return 0;
}
if(count !=0){
arr[count-1]=value;
}
else{
x=value;
}
count++;
}
value=0;
for(int i =0;i<count;i++){
value+=arr[count]*pow(x,count-i);
}
printf("Vysledok je :%f\n",value);
printf("Enter date: ");
char dateStr[11];
struct tm t;
fgets(dateStr, 11, stdin);
strptime(dateStr, "%d.%m.%Y", &t);
t.tm_mday += 7;
strftime(dateStr, sizeof(dateStr), "%d.%m.%Y", &t);
printf("The day of the week is %s", dateStr);
exit(EXIT_SUCCESS);
return 0;
}