Question

In: Computer Science

Look at the C code below. Identify the statements that contain a syntax error OR logical...

Look at the C code below. Identify the statements that contain a syntax error OR logical error. Evaluate each statement as if all previous statements are correct. Select all that apply

                #include <stdio>

                Int main()

                {

                                Float webbing;

                                Puts(“Please enter the amount of webbing per cartridge: “)

                                Scanf(“%f”, webbing);

                                Printf(“You entered: “+ webbing + “\n”);

                                Return 0;

                }

Answers:

                Including the library for I/O

                Declaring a variable

                Writing output to the console using puts

                Getting input from the console

                Writing output to the console using printf

Solutions

Expert Solution

syntax error in #include<stdio>

.h is missing correct statement is #include<stdio.h>

syntax error in Int and Float

int and float should starts with small letter.

Puts also starts with capital letter correct is puts.

you have to include header file to access puts

#include<string.h>

ambracent is missing in scanf and

Scanf starts with capital letter this is wrong scanf starts with small letter

printf must starts with small letter and format specifier is missing %f. there is no concatenation.

return must starts with small letter. you put “ ” instead of ".

correct program is:

#include<stdio.h>
#include<string.h>
int main()
{
   float webbing;
   puts("Please enter the amount of webbing per cartridge: ");
   scanf("%f",&webbing);
   printf("You entered: %f\n",webbing);
   return 0;
}

Output:


               


Related Solutions

For each of the following Visual Basic code snippets, identify the syntax error.   If intX >...
For each of the following Visual Basic code snippets, identify the syntax error.   If intX > 100   lblResult.Text = "Invalid Data" End If   Dim str As String = "Hello" Dim intLength As Integer intLength = Length(str) If intZ < 10 Then   lblResult.Text = "Invalid Data"   Dim str As String = "123" If str.IsNumeric Then   lblResult.Text = "It is a number." End If   Select Case intX   Case < 0     lblResult.Text = "Value too low."   Case > 100     lblResult.Text = "Value too high."   Case Else     lblResult.Text = "Value...
C++ : Find the syntax errors in the following program. For each syntax error, fix it...
C++ : Find the syntax errors in the following program. For each syntax error, fix it and add a comment at the end of the line explaining what the error was. #include <iostream> #include <cmath> using namespace std; int main(){ Double a, b, c; 2=b; cout<<"Enter length of hypotenuse"<<endl; cin>>c>>endl; cout>>"Enter length of a side"<<endl; cin>>a; double intermediate = pow(c, 2)-pow(a, 2); b = sqrt(intermediate); cout<<"Length of other side is:" b<<endline; return 0; }
The files provided in the code editor to the right contain syntax and/or logic errors. In...
The files provided in the code editor to the right contain syntax and/or logic errors. In each case, determine and fix the problem, remove all syntax and coding errors, and run the program to ensure it works properly. DebugBox.java public class DebugBox { private int width; private int length; private int height; public DebugBox() { length = 1; width = 1; height = 1; } public DebugBox(int width, int length, height) { width = width; length = length; height =...
The files provided in the code editor to the right contain syntax and/or logic errors. In...
The files provided in the code editor to the right contain syntax and/or logic errors. In each case, determine and fix the problem, remove all syntax and coding errors, and run the program to ensure it works properly. Please Fix code and make Copy/Paste avaliable // Application allows user to enter a series of words // and displays them in reverse order import java.util.*; public class DebugEight4 {    public static void main(String[] args)    {       Scanner input = new Scanner(System.in);       int...
Could someone point out the logical error in this code? The code seems to start at...
Could someone point out the logical error in this code? The code seems to start at the last input. But I want the code to output something like this: Enter name: A Enter time:5 Enter name:B Enter time: 4 Enter name: C Enter time:3 Enter name:D Enter time: 9 Enter name: E Enter time: 11 A process is started and ends in 5 sec. 1 sec passed... 2 sec passed... 3 sec passed... 4 sec passed... 5 sec passed... B...
If a switch statement contains no break statements at all, a. a syntax error will occur...
If a switch statement contains no break statements at all, a. a syntax error will occur b. each of the case clauses will be executed every time the switch statement is encountered c. this is equivalent to having the switch statement always take the default clause, if one is present d. this is not a syntax error but nothing within the switch statement will ever be executed e. None of these Which one of these options?
The following code has some syntax error. Please fixed the error. Besides, I want the output...
The following code has some syntax error. Please fixed the error. Besides, I want the output in ASCII characters. Please give me the corrected code along with the screenshot of the output. def cbc_dec(ys): int xs = [] int iv = ("0XAA", 16) #in decimal int key = ("0X08", 16) int x0 = chr(((163 * (int (ys[0], 16) - key)) % 256) ^ iv) xs.append(x0) for i in range (1, len(ys)): int xi = chr((( 163 * (int (ys[i], 16)...
this code still shows that it still has an syntax error in it can you please...
this code still shows that it still has an syntax error in it can you please fix it. I will put an error message next to the line that is wrong and needs fixed, other than that the other lines seems to be ok. public static void main() { /** * main method - makes this an executable program. */ public static void main("String[]args"); this is the error line that I get and needs fixed // create a client with...
Syntax error in C. I am not familiar with C at all and I keep getting...
Syntax error in C. I am not familiar with C at all and I keep getting this one error "c error expected identifier or '(' before } token" Please show me where I made the error. The error is said to be on the very last line, so the very last bracket #include #include #include #include   int main(int argc, char*_argv[]) {     int input;     if (argc < 2)     {         input = promptUserInput();     }     else     {         input = (int)strtol(_argv[1],NULL, 10);     }     printResult(input);...
identify the syntax errors in the following code:             public class Hello {                    &
identify the syntax errors in the following code:             public class Hello {                         private static int main(String [] args) {                                     string Msg=”Hello, Wrld!;                                     Sytem.out.println(msg+ “Ken")
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT