a. explain the logic of why this code produces this output #include int f(int n,float x); main( ) {int a=10,n=12,p;  float x=2.2, y=7.4;  p=f(n,y);  printf("%d %d\n",n,p);  for(n=1;n<3;n++)  printf("%d %d\n",n,f(n,x));  if(x++>3)  printf("too big x=%f\n",x);  else

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
icon
Concept explainers
Question

1a. explain the logic of why this code produces this output

#include <stdio.h>
int f(int n,float x);
main( )
{int a=10,n=12,p;
 float x=2.2, y=7.4;
 p=f(n,y);
 printf("%d %d\n",n,p);
 for(n=1;n<3;n++)
 printf("%d %d\n",n,f(n,x));
 if(x++>3)
 printf("too big x=%f\n",x);
 else
 printf("too small x=%f\n",x); }
int f(int a,float x)
{int n=5;
 if(x>3)
 {a=a+2;
 x=x+2;
 return a-x;}
 else
 {n=n-3;
 x=x-3;
 return n;
 }
 }
output:
12 4
1 2
2 2
too small x=3.200000

1B.explain the logic of why this code produces this output

 #include <stdio.h>
main( )
{int a=3,b,d=12;
 float c,f=7.2;
 b=a++ * 2;
 printf("%d %d\n",a,b);
 b=++a *2;
 printf("%d %d\n",a,b);
 c = f+d/10 ;
 f += d%8;
 printf("%f %f\n",c,f);
}
output:
4 6
5 10
8.200000 11.200000

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Control Structure
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