can someone help explain the logic for this both of these pieces of code and why they are getting that output A. #include #define quick(x,y) x*x+y*y  main( ) {float x=1.5,y=2.0,z=18.0,w=3.0,t=2.0;  float a = 5.0, b=6.0,c = 4.0,d=10.0,e=12.0;  int i=7;  x = y+z/w*t;  a = 10/3*y;  t = c*quick(w+1.0,3.0*t);  d = b++*c;  e = (float)(i/2);  printf("%f %f %f",x,a,t);  printf(" %f %f %f",b,d,e); } output: 14.000000 6.000000 52.000000 7.000000 24.000000 3.000000 B. #include int f(int n,int m); main( ) {int n=5,m=8,k=10,j=13,i=0;  for(i=1;i<3;++i) {j = f(m,k-2*i);  printf("%d %d %d %d\n",j,n,m,k); } } int f(int n, int m) {int k;  if(n>m)  k=n%m+1;  k=m%n--; return k; } output: 0 5 8 10 6 5 8 10

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

can someone help explain the logic for this both of these pieces of code and why they are getting that output


A.
#include <stdio.h>
#define quick(x,y) x*x+y*y
 main( )
{float x=1.5,y=2.0,z=18.0,w=3.0,t=2.0;
 float a = 5.0, b=6.0,c = 4.0,d=10.0,e=12.0;
 int i=7;
 x = y+z/w*t;
 a = 10/3*y;
 t = c*quick(w+1.0,3.0*t);
 d = b++*c;
 e = (float)(i/2);
 printf("%f %f %f",x,a,t);
 printf(" %f %f %f",b,d,e);
}
output:
14.000000 6.000000 52.000000 7.000000 24.000000 3.000000
B.
#include <stdio.h>
int f(int n,int m);
main( )
{int n=5,m=8,k=10,j=13,i=0;
 for(i=1;i<3;++i)
{j = f(m,k-2*i);
 printf("%d %d %d %d\n",j,n,m,k);
}
}
int f(int n, int m)
{int k;
 if(n>m)
 k=n%m+1;
 k=m%n--;
return k;
}
output:
0 5 8 10
6 5 8 10 

Expert Solution
steps

Step by step

Solved in 4 steps

Blurred answer
Knowledge Booster
Random Class and its operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education