add
This commit is contained in:
parent
a7380f143d
commit
b27803f4b8
@ -1,18 +1,24 @@
|
||||
#include<stdio.h>
|
||||
|
||||
int main(){
|
||||
int counter=0, Sym;
|
||||
char OutSym;
|
||||
int counter=0, Sym;
|
||||
char OutSym;
|
||||
|
||||
while(1){
|
||||
Sym=getchar();
|
||||
if(Sym==EOF || Sym==0)break;
|
||||
else if(Sym<='Z'&&Sym>='A')Sym +=32;
|
||||
else if(Sym<='z'&&Sym>='a')Sym-=32;
|
||||
counter++;
|
||||
OutSym=Sym;
|
||||
putchar(OutSym);
|
||||
}
|
||||
printf("\nPočet riadkov: %d\n",counter);
|
||||
while(1){
|
||||
Sym=getchar();
|
||||
if(Sym=='\n'){
|
||||
counter++;
|
||||
}
|
||||
if(Sym==EOF){
|
||||
//counter++;
|
||||
break;
|
||||
}
|
||||
else if(Sym<='Z'&&Sym>='A')Sym +=32;
|
||||
else if(Sym<='z'&&Sym>='a')Sym-=32;
|
||||
//counter++;
|
||||
OutSym=Sym;
|
||||
putchar(OutSym);
|
||||
}
|
||||
printf("\nPočet riadkov: %d\n",counter);
|
||||
return 0;
|
||||
}
|
||||
|
49
du3/program.c
Normal file
49
du3/program.c
Normal file
@ -0,0 +1,49 @@
|
||||
#include<stdio.h>
|
||||
#include<stdlib.h>
|
||||
#include<string.h>
|
||||
#include<math.h>
|
||||
#define SIZE 30
|
||||
|
||||
int main(){
|
||||
char pol[SIZE];
|
||||
memset(pol,' ',SIZE);
|
||||
pol[SIZE]='\0';
|
||||
|
||||
int ch=0;
|
||||
|
||||
for(int idx=0;1;idx++ ){
|
||||
ch=getchar();
|
||||
if(ch==EOF||ch==' ')break;
|
||||
pol[idx]=ch;
|
||||
}
|
||||
|
||||
printf("%s\n",pol);
|
||||
|
||||
int koef=0;
|
||||
for(int i=0;i<strlen(pol);i++)if(pol[i]=='\n')koef++;
|
||||
|
||||
float x=0;
|
||||
char *end = NULL;
|
||||
char *start = pol;
|
||||
x=strtof(start,&end);
|
||||
start=end;
|
||||
|
||||
float num=0;
|
||||
for(int i=0;i<koef;i++){
|
||||
float p=1, n=0;
|
||||
n=strtof(start,&end);
|
||||
if(n)start=end;
|
||||
else break;
|
||||
|
||||
for(int idx=(koef-i)-1;idx>0;idx--)p*=x;
|
||||
|
||||
num+=p*n;
|
||||
}
|
||||
|
||||
//num=34.577;
|
||||
num=round(num*100)/100;
|
||||
|
||||
printf("%.2f\n", num);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user