Computer Science: A Structured Programming Approach Using C, Third Edition
3rd Edition
ISBN: 9780534491321
Author: Behrouz A. Forouzan, Richard F. Gilberg
Publisher: Course Technology, Inc.
expand_more
expand_more
format_list_bulleted
Expert Solution & Answer
Chapter 2, Problem 29PS
Explanation of Solution
Given: The following
int main(void)
{
//local Declarations
a int;
b : c : d char;
d, e, f double float;
//statements
printf("The end of the program. ");
return 0;
}//main
To find: The errors in the aforementioned program.
Solution:
In the aforementioned program, there are declaration errors due to which the program will show errors by displaying messages that the identifiers, such as a, b, c, d, e, f are undefined...
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Find any errors in the following program.
/* This is another program with some errors in it to be corrected.
int main (void)
{
// Local Declarations
a int;
b float, double;
c, d char;
// Statements printf("The end of the program.");
return 0;
} // main
Find any errors in the following program.
include <stdio.h>
int main (void)
{
printf('hi how r u');
printf('c language ');
return 0;
}//ain
Find any errors in the following program./* This is the last program to be corrected in these exercises.
int main (void)
// Local Declarations
a int;
b :c :d char;
d, e, f double float;
// Statementsprintf("The end of the program.");
return 0;
} // main
Chapter 2 Solutions
Computer Science: A Structured Programming Approach Using C, Third Edition
Ch. 2 - The purpose of a header file, such as stdio.h, is...Ch. 2 - Prob. 2PSCh. 2 - The C standard function that receives data from...Ch. 2 - Which of the following statements about the...Ch. 2 - Which of the following statements about block...Ch. 2 - Prob. 6PSCh. 2 - Which of the following is not a data type?...Ch. 2 - The code that establishes the original value for a...Ch. 2 - Prob. 9PSCh. 2 - Prob. 10PS
Ch. 2 - To print data left justified, you would use a in...Ch. 2 - Prob. 12PSCh. 2 - One of the most common errors for new programmers...Ch. 2 - Which of the following is not a character constant...Ch. 2 - Which of the following is not an integer constant...Ch. 2 - Which of the following is not a floating-point...Ch. 2 - Prob. 17PSCh. 2 - Which of the following is not a valid identifier...Ch. 2 - What is the type of each of the following...Ch. 2 - What is the type of each of the following...Ch. 2 - Which of the following identifiers are valid and...Ch. 2 - Which of the following identifiers are valid and...Ch. 2 - What is output from the following program...Ch. 2 - Prob. 24PSCh. 2 - Find any errors in the following program....Ch. 2 - Find any errors in the following program....Ch. 2 - Prob. 27PSCh. 2 - Prob. 28PSCh. 2 - Prob. 29PSCh. 2 - Code the variable declarations for each of the...Ch. 2 - Code the variable declarations for each of the...Ch. 2 - Write a statement to print the following line....Ch. 2 - Write a program that uses four print statements to...Ch. 2 - Write a program that uses four print statements to...Ch. 2 - Write a program that uses defined constants for...Ch. 2 - Prob. 36PSCh. 2 - Prob. 37PSCh. 2 - Write a program that prompts the user to enter an...Ch. 2 - Write a C program using printf statements to print...Ch. 2 - Write a program that reads a character, an...Ch. 2 - Write a program that prompts the user to enter...Ch. 2 - Write a program that reads 10 integers and prints...Ch. 2 - Write a program that reads nine integers and...
Knowledge Booster
Similar questions
- Explain these c++ statements void bar(int panam) {panam +=1;}arrow_forwardFind any errors in the following program. // This program does nothing int main { return 0; }arrow_forwardShow the value of x after each of the following statements is performed:a) x = fabs(7.5);b) x = floor(7.5);c) x = fabs(0.0);d) x = ceil(0.0);e) x = fabs(-6.4);f) x = ceil(-6.4);g) x = ceil(-fabs(-8 + floor(-5.5)));arrow_forward
- Computer Science Python 3 1) It will need to accept user input (At several different points) 2) Each mathematic operation needs to be it's own function/method: Addition - Takes up to 5 arguments Subtraction - - Takes 3 arguments Multiplication - Takes 4 arguments Division - Takes 2 arguments Log - Takes 1 argument Raise a number to a power ex. X squared Solve Pythagorean theorem Factorial 3) Create the ability for a user to use up to 3 of the aforementioned operations together. Example, I can add 5 numbers making result X. I may then take X, and divide it by 4, generating result Y. That's an example of 2, but you get the idea.arrow_forwardIDENTIFY THE CALL STATEMENTS, ALGORITHM, AND LISTS IN THE CODE BELOW. #BMI Program def printBMI(weight,height): bmi = weight/(height*height) print("BMI is: ",bmi,"and you are ",end="") if bmi <= 18.5: print("underweight") elif 18.5 < bmi < 25: print("normal") elif 25 < bmi < 30: print("overweight") elif bmi > 30: print("obese") #MAIN PROGRAM choice = input("Press I for imperial or M for metric: ") if choice == 'I': Imperialweight = float(input("Enter weight in pounds: ")) Imperialheight = float(input("Enter height in feet (decimals): ")) Imperialweight = Imperialweight * 703 Imperialheight = Imperialheight * 12 printBMI(Imperialweight ,Imperialheight) elif choice == 'M': Metricweight = float(input("Enter weight in kilograms: ")) Metricheight = float(input("Enter height in meters: ")) printBMI(Metricweight,Metricheight)arrow_forwardPoint out the errors if any in the following part of the program in c++ void main() { int a=30; f(); } void f() { int b=10; }arrow_forward
- Fix the mistakes in the following program so it runs as expected. There are 5 mistakes. All literals (such as 3.5) have the correct value and data type. // Java program by [Student name] [Today's date] public class Mistakes { public static void main(String[] args) { / This is a comment int z = 3.5; System.out.println("z is + z"); int s2 = "Michael"; System.out.println("s2 has the value " s2); } } Please show the mistakes clearly and how the change is made.arrow_forwardTime-saving statements are those that have been prepared in advance.Why?arrow_forwardExplain the following in your own words without copying it from anywhere. Give examples each in your explanation.a. Class hierarchies b. Algorithmsc. Flowchartsd. Control structureII. Write a program in C++ for the following equations of motion. v = u +at S = ut +1/2 at^2 s = 1/2 t (v + u) v^2 = u^2 + 2asarrow_forward
- (Numerical) a. Write a C++ program that accepts an integer argument and determines whether the passed integer is even or odd. (Hint: Use the % operator.) b. Enter, compile, and run the program written for Exercise 8a.arrow_forwardIdentify all syntax errors in the following program and rewrite it so that there are no syntax errors. You must not remove any significant part of the given program to fix the errors. */ A simple program /* #include iostream using namespace std int main(); { intz; intx; z = 3; x = 2 cout < "The values of the user-defined variables are " << x < z; return 0; }arrow_forwardComputer Science Title: Programming - Practical Test 1 - SET 3Learning Objective:Write simple Java programs using basic data types, operators and expressions.Write Java programs using control structures - Sequence Question:Prepare a program that can read the price (RM) of two books. Calculate and print the total price (RM) of the two books that includes 5% discount.. Based on the given problem, the student need to:i. Write the Java programii. Display the output[100% marks] Sample input and output:Input price of book 1 : 50.50Input price of book 2 : 90.90Total price : 141.4Discount : 7.07Net paymant : 134.33 help me please asap.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:Cengage
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage