Which program outputs "Hello World.." .?a.main(){scanf("Hello World..");}b.main(){printf("Hello World..");}c.main(){print("Hello World..");}d.main(){scan("Hello World..");}
Question
Which program outputs "Hello World.." .?a.main(){scanf("Hello World..");}b.main(){printf("Hello World..");}c.main(){print("Hello World..");}d.main(){scan("Hello World..");}
Solution
The correct program that outputs "Hello World.." is option b. Here's why:
a. main(){scanf("Hello World..");} - This is incorrect. The scanf function is used for input, not output.
b. main(){printf("Hello World..");} - This is correct. The printf function is used to output (print) the text "Hello World..".
c. main(){print("Hello World..");} - This is incorrect. In C language, the correct function for output is printf, not print.
d. main(){scan("Hello World..");} - This is incorrect. There is no function called scan in C language. For input, the correct function is scanf.
Similar Questions
What is the output of the following C code?#include <stdio.h>void foo() { printf("Hello, World!\n");}int main() { foo(); return 0;}
Which of the following function used as reading data ?Options :main()print()scanf()printf()
What will the following code print out when it is run?Scanner scnr = new Scanner("Hello \n\n World!");String c = scnr.next();String b = scnr.nextLine();String a = scnr.next();System.out.println(":" + a + ":" + b + ":");Group of answer choices:Hello:World!::World!: ::Hello: :: : World!:
What will be the output of the following code ?#include<stdio.h>int main(){char c='A';switch(c){case 64+1: printf("hello ");break;case 8*8+4: printf("world ");break;default: printf("myworld");}printf("welcome");}
What will be the output of the following program?#include<stdio.h> int main() { int i=3; switch(i) { case 1: printf("Hello"); case 2: printf("Hi"); case 3: continue; default: printf("Bye"); } return 0; }Select one:Compilation ErrorNo outputByeHello Hi
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.