diff --git a/du1/program.c b/du1/program.c index 684da7c..70115fc 100644 --- a/du1/program.c +++ b/du1/program.c @@ -1,18 +1,24 @@ #include 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; -} +} diff --git a/du3/program.c b/du3/program.c new file mode 100644 index 0000000..93a4614 --- /dev/null +++ b/du3/program.c @@ -0,0 +1,49 @@ +#include +#include +#include +#include +#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;i0;idx--)p*=x; + + num+=p*n; + } + + //num=34.577; + num=round(num*100)/100; + + printf("%.2f\n", num); + return EXIT_SUCCESS; +} +