EBK C HOW TO PROGRAM
8th Edition
ISBN: 9780133964639
Author: Deitel
Publisher: PEARSON CUSTOM PUB.(CONSIGNMENT)
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Chapter 6, Problem 6.13E
a)
Program Plan Intro
To find the error in each of the following statement.
b)
Program Plan Intro
To find the error in each of the following statement.
c)
Program Plan Intro
To find the error in each of the following statement.
d)
Program Plan Intro
To find the error in each of the following statement.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
10. a. Point Out errors:
#include
void main()
{
char arr[8]="Rhombus";
int i;
for(i=0;i
#include
void main()
{
char *str1="United";
char *str2="Front";
char *str3;
str3=strcat(str1,str2);
printf("\n %s",str3);
[-
[-
c. Compare Union and Structure.
#include <stdio.h>int main(){int d;int s[20],i, r, p, lg=0,m;char c;printf("Enter number of salesman(max 20): ");scanf("%d", &d);for(i=0; i<d; i++){ printf("\n salesman %d sales: ");scanf("%d", &s[i]);}for(i=0; i<d; i++){for(r=i+1; j<d; r++){if(s[i] > s[r]){p= s[i];s[i] = s[r];s[j] = p;}}}printf("\nsalesman lowest to highest: ");for(i=0; i<d; i++){printf("%d\t", s[i]);}for(i=0;i<m;i++){printf("\n highest sales: %d ",lg);if(lg<=s[i])lg=s[i];break;}getch();}
>>>
the upper part output should be like this
enter number of salesman (max 20): 5
salesman 1 500
salesman 2 300
salesman 3 1000
salesman 4 200
salesman 5 1000
in the lower part the lowest to highest the output should become like this
salesman 4 200
salesman 2 300
salesman 1 500
salesman 3 1000
salesman 5 1000
highest total sales : 2000
be recor
#include
#include
minutes
#include
limit on
int func(int, int, int, int);
main(){
srand(time(NULL));
int a, b, c, fNum;
printf("Choose three different numbers between 0-39:");
scanf ("%d%d%d", &a, &b, &c);
fNum = func (a, b, c, 25);
printf("\nThe result: %d", fNum);
}
int func (int ul, int u2, int u3, int iter){
srand (time (NULL));
int n1=0, i=0, count=0;
for (;i
Chapter 6 Solutions
EBK C HOW TO PROGRAM
Ch. 6 - Fill in the blanks in each of the following: C...Ch. 6 - State which of the following are true and which...Ch. 6 - Write statements to accomplish each of the...Ch. 6 - Consider a 2-by-5 integer array t. Write a...Ch. 6 - (Sales Commissions) Use a one-dimensional array to...Ch. 6 - (Bubble Sort) The bubble sort presented in Fig....Ch. 6 - Write loops that perform each of the following...Ch. 6 - Prob. 6.13ECh. 6 - (Mean, Median and Mode Program Modifications)...Ch. 6 - (Duplicate Elimination) Use a one-dimensional...
Ch. 6 - Label the elements of 3-by-5 two-dimensional array...Ch. 6 - What does the following program do?Ch. 6 - What does the following program do?Ch. 6 - (Dice Rolling) Write a program that simulates the...Ch. 6 - (Game of Craps) Write a program that runs 1000...Ch. 6 - Prob. 6.21ECh. 6 - (Total Sales) Use a two-dimensional array to solve...Ch. 6 - (Turtle Graphics) The Logo language made the...Ch. 6 - Prob. 6.24ECh. 6 - (Knights Tour: Brute-Force Approaches) In Exercise...Ch. 6 - (Eight Queens) Another puzzler for chess buffs is...Ch. 6 - (Eight Queens: Brute-Force Approaches) In this...Ch. 6 - (Duplicate Elimination) In Chapter 12, we explore...Ch. 6 - (Knights Tour: Closed Tour Test) In the Knights...Ch. 6 - (The Sieve of Eratosthenes) A prime integer is any...Ch. 6 - Prob. 6.31RECh. 6 - (Linear Search) Modify the program of Fig. 6.18 to...Ch. 6 - (Binary Search) Modify the program of Fig. 6.19 to...Ch. 6 - Prob. 6.35RECh. 6 - Prob. 6.36RECh. 6 - Prob. 6.37RE
Knowledge Booster
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
- Program to remove errors */ #include int main() int num1, num2, num3; printf("enter first number "); Scanf ("%d" &num1); printf(enter second number "); scanf("%f", num2); num3 = num2++ printf " The result is %d", num3 ; return 0; }arrow_forwarddef f(x: float) -> int: return int(x) def g(x: str) -> float: return float(x) y = f(g("3.14")) Select all of the following statements that are true: y's inferred data type is float O y 's inferred data type is str O y's inferred data type is int There is a type error in this program None of the above are truearrow_forwardHelp me run this code in C language #include <stdio.h> int main(){ int num1,num2; float result; char ch; //to store operator choice printf("Enter first number: "); scanf("%d",&num1); printf("Enter second number: "); scanf("%d",&num2); printf("Choose operation to perform (+,-,*,/,%): "); scanf(" %c",&ch); result=0; switch(ch) { case '+': result=num1+num2; break; case '-': result=num1-num2; break; case '*': result=num1*num2; break; case '/': result=(float)num1/(float)num2; break; case '%': result=num1%num2; break; default: printf("Invalid operation.\n"); } printf("Result: %d %c %d = %f\n",num1,ch,num2,result); return…arrow_forward
- Refer to the statement below, #include void main() { int i; int number[11]={12,15,17,3,2,7,10,10,15,15,50}; for(i=0;i < 11; į++){ printf(" %d", number[i]); } Write a segment in C language to: Compute the average number Find the maхітит аnd minimum питberarrow_forwardComputer Science What does the following code print out? void confuse(int * a, int * b) { int * c = b; *a = *b + *c; a = c; *a = *b + *c; } int main() { char a[4] = “cat\0”; char b[4] = “bar\0”; char * c; c = b; c[0] = 'p'; c = b + 1; int * x; int * y; int * z; printf(“%s%s\n”, a, b); printf(“%s%s\n”, c, a); int i = 5; int j = 1; int * x = &i; int * y = &j; printf(“%d, %d\n”, *x, *y); confuse(x, y); printf(“%d, %d\n”, *x, *y); }arrow_forward#include int main() { } int num1, num2, sum; printf("Enter two integers: "); scanf("%d %d", &num 1, &num2); // Calculate the sum of the two numbers and store it in the 'sum variable. // TODO: Write your code here. printf("Sum: %d\n", sum); return 0; Questions: 1. Complete the C program above by writing code to calculate the sum of the two integers (num1 and num2) entered by the user. 2. Run the program and verify that it correctly calculates and displays the sum.arrow_forward
- Compute: z = x/|y| #include <stdio.h>#include <math.h> int main(void) { double x; double y; double z; scanf("%lf", &x); scanf("%lf", &y); /* Your code goes here */ printf("%.2lf\n", z); return 0;arrow_forwardEach of the following definitions and program segments has errors. Locate as many as you can and correct the errors. a) void showValues (int nums) { for (int i = 0; i<8; i++) cout<arrow_forward#include <stdio.h>int main(){int i, j, k=0;for (i=1; i<3; i++){for (j=1; j<3; j++){k = i+j;printf("Value of k is %d\n" ,k);}}printf("Value of k is %d\n",2*k);return 0;} how do you modify this code so k only prints even numbersarrow_forwardc programming please fix my codes #include <stdio.h> #include<string.h> int main() { char vegetables[50][20]; float result; int choice, num; printf("Press 1 to Add vegetables\n"); printf("Press 2 to Update vegetables\n"); printf("Press 3 to Display vegetables\n"); printf(" press 4 to terminate): printf("Enter your choice:\n"); choice = input(); switch (choice) { case 1: { printf("type any vegetables:\n"); num = input(); printf("enter quantity of vegetables"); output(result); break; } case 2: { printf("search any vegetables ="); output(result); printf(" current quantity of the vegetables: "); printf(" enter the new quantity : ); break; } case 3: { printf("Enter to display vegetables:\n"); num = input(); printf("\n\n\n vegetables\n\n\n quantity\n\n\n remarks\n\n\n ");…arrow_forward#include <stdio.h> int main(){ int M; printf("Enter the number of chairs you want to enter:\n"); scanf("%d", &M); double price[M]; double sum = 0.0; int i=0; while(i < M) { printf("Enter price of chair #%d: ",(i+1)); scanf("%lf", &price[i]); if(price[i] < 1003) { price[i] = price[i] - price[i] * 0.10; sum = sum + price[i]; } else if(price[i] >= 1003 && price[i] <= 2006) price[i] = price[i] - price[i] * 0.15; else if(price[i] > 2006) price[i] = price[i] - price[i] * 0.20; printf("Price of chair #%d after discount is %.3lf\n", (i+1), price[i]); i++; } printf("\n\nTotal price after discount of all chairs which got a discount of 10%% is "); printf("%.3lf", sum); int N = 2; printf("\n\nN is equal to the sum of My EUI ID(1+1) = 2"); double p[N]; printf("\nEnter price of %d desks: ",…arrow_forward#include <stdio.h> #include <stdlib.h> void LineFunc(void); void main() { int a, b; printf("Enter a :"); scanf_s("%d", &a); printf("Enter b :"); scanf_s("%d", &b); LineFunc(); printf("\n\n"); system("pause"); } void LineFunc(void) { int i,j; int a=1, b = 0, y; for (i = -10; i < 11; i++) { for (j = 10; j > -11; j--) { y = a * i + b; if (i == 0 ) { printf("-"); } else if (j == 0) { printf("|"); } else if (i == 0 && j == 0) { printf("+"); } else if (y == j) { printf("*"); } else printf(" "); } printf("\n"); } } Can you please run this code for me in c language?arrow_forwardarrow_back_iosSEE MORE QUESTIONSarrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
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)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education