Run the “hello, world”
To run the hello world program and experiment with leaving out parts of the hello world program, to see the error message.
Explanation of Solution
Program:
//Leaving out header file //#include <stdio.h> main() { printf("Hello, "); printf("World"); printf("\n"); }
Explanation:
The program above leaving the header file <stdio.h> statement to see the error. There is a warning in the program and shows the output.
Sample Output:
Program:
#include <stdio.h> //Leaving out main function //main() { printf("Hello, "); printf("World"); printf("\n"); }
Explanation:
The program above leaving the main function to see the error. There is an error in program line 4.
Sample Output:
Program:
#include <stdio.h> main() { //Leaving out first statement line //printf("Hello, "); printf("World"); printf("\n"); }
Explanation:
The program above leaving the first statement line to see the error. There is no error and print world, then a new line.
Sample Output:
Program:
#include <stdio.h> main() { printf("Hello, "); //Leaving out second statement line //printf("World"); printf("\n"); }
Explanation:
The program above leaving the second statement line to see the error. There is no error and print hello, then a new line.
Sample Output:
Program:
#include <stdio.h> main() { printf("Hello, "); printf("World"); //Leaving out third statement line //printf("\n"); }
Explanation:
The program above leaving the third statement line to see the error. There is no error and print hello,world without a new line.
Sample Output:
Program:
#include <stdio.h> //Leaving out curley braces. main() //{ printf("Hello, "); printf("World"); printf("\n"); //}
Explanation:
On leaving the curly braces the program will not compile and produce compilation error.
Sample Output:
Want to see more full solutions like this?
Chapter 1 Solutions
C Programming Language
Additional Engineering Textbook Solutions
Web Development and Design Foundations with HTML5 (9th Edition) (What's New in Computer Science)
C++ How to Program (10th Edition)
Java: An Introduction to Problem Solving and Programming (8th Edition)
Starting Out with C++ from Control Structures to Objects (9th Edition)
Starting Out with Java: From Control Structures through Data Structures (3rd Edition)
- Write a program that converts temperatures from Fahrenheit to Celsius.arrow_forwardSo the histogram isn't showing in my program when I type 0, it just says invalid input and continues on with the code. I see it works on your side, but I need it to stop the code completely and show the stars for the numbers inputed.arrow_forwardPost the picture/screenshot of the flowchart of the machine problem here. Use START and END please. Thank youarrow_forward
- Programming Exercise Numeric Triangle Pattern Based on the example given on the previous module, create a program that replicated the triangle pattern shown. Try to look at the examples closely and think of an algorithm that replicates the outputs. Let's see if you still look at Triangle problems the same way after this problem. Input: Integer value n. Output: A triangle based on the inputted value of n. Sample Input and Outputs: Input Output 3 ** *** 4 * ** *** **** 7 * ** *** **** *****arrow_forwardWhy does it come out as error?arrow_forwardCan you do it using the Raptor program please?arrow_forward
- Why is it difficult to tell whether a program is correct? How do you go about finding bugs in your code? What kinds of bugs are revealed by testing? What kinds of bugs are not?arrow_forwardPlease add interrupts to this code. Modify this as it's not using any interrupts in the implementation. Use a button or a sensed condition that trigger the temperature to read, then switch on the LCD and display. Or simply sense and display the new temperature in response to a different input.arrow_forwardwrite a program to enter a user name and display the message (hello) three times. The first one for (Mena), the second one for (Nastia) and the third for any user as a guest. (For example, hello mena, hello Nastia et.al.)arrow_forward
- 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