diff --git a/du3/Makefile b/du3/Makefile new file mode 100644 index 0000000..0ea6a29 --- /dev/null +++ b/du3/Makefile @@ -0,0 +1 @@ +gcc -std=c11 -lm program.c -o program \ No newline at end of file diff --git a/du3/program b/du3/program index 14d0d4b..7214f89 100755 Binary files a/du3/program and b/du3/program differ diff --git a/du3/program.c b/du3/program.c index 97c7a45..1e4791c 100644 --- a/du3/program.c +++ b/du3/program.c @@ -1,55 +1,29 @@ #include #include #include +#define LINE_SIZE 100 + //#include -/*int main() -{ - float a[100],sum=0,x; - int n,i; - printf("\nEnter the value of X :: "); - scanf("%f",&x); - // printf("\nEnter degree of the polynomial X :: "); - //scanf("%d",&n); - printf("\nEnter coefficient's of the polynomial X :: \n"); - for(i=n;i>=0;i--) - { - printf("\nEnter Coefficient of [ X^%d ] :: ",i); - scanf("%f",&a[i]); - } - - for(i=n;i>0;i--) - { - sum=(sum+a[i])*x; - } - - sum=sum+a[0]; - - printf("\nValue of the polynomial is = [ %f ]\n",sum); - - return 0; -} -*/ - -void main() { +/*void main() { int degree,x; int coeff[10], i; int sum = 0; + // Getting the value of the variable + printf("\nEnter the value of x: "); + scanf("%d",&x); + // Getting the degreee of the polynomial printf("\nEnter the degree of the polynomial: "); scanf("%d",°ree); - // Getting the coefficients of all terms of the polynomial + // Getting the coefficients of all terms of the polynomial printf("\nEnter the coeffients from lower order to higher order: \n"); for(i=0; i<=degree; i++) { scanf("%d",&coeff[i]); } - // Getting the value of the variable - printf("\nEnter the value of x: "); - scanf("%d",&x); - // Applying Horner's rule sum = coeff[degree]; for(i=degree-1; i>=0; i--) { @@ -58,4 +32,21 @@ void main() { // Printing result printf("\nResult: %d",sum); +} + +*/ + +int main(){ + int pole[LINE_SIZE]; + int n=0; + char*vstup; + char riadok[LINE_SIZE]; + do { + vstup=fgets(riadok,LINE_SIZE,stdin); + n++; + }while(*vstup!='\n'); + //printf("%s",*vstup); + for(int i=0;n>i;i++){ + printf("%s",vstup); + } } \ No newline at end of file