Ask Programiz - Human Support for Coding Beginners
Explore questions from fellow beginners answered by our human experts. Have some doubts about coding fundamentals? Enroll in our course and get personalized help right within your lessons.

In C, you can take user input using the scanf() function. It reads values entered by the user and stores them in variables. For example,
#include
int main() {
int number;
printf("Enter a number: ");
// Take input and store it in number variable
scanf("%d", &number);
printf("You entered: %d\n", number);
return 0;
} Output
Enter a number: 42
You entered: 42Here,
printf()asks the user to enter a number.scanf("%d", &number);takes the user's input and stores it in thenumbervariable.%dtellsscanfthat you're expecting an integer.&numberis the address of the variable where the input will be stored.
Finally,
printf()displays the entered number.
Note: Always remember to use & (address-of operator) before the variable name in scanf().

printf() is used to display text or values on the screen.
For Example:
printf("Hello, World");
The above code displays the text Hello, World on the screen.
I hope this clears your confusion. If you have more questions feel free to ask!

In C, scanf() is used to read input from the user, while printf() is used to display output on the screen.
Think of it this way:
scanf()receives data (input)printf()sends data to the screen (output)
Example:
#include
int main() {
int age;
printf("Enter your age: "); // Output
scanf("%d", &age); // Input
printf("You are %d years old.", age); // Output
return 0;
} Here, printf() first prompts the user, and then scanf() captures the input into the age variable. After that, printf() is used again to show the result.

For integers, the format specifier is %d. For other types:
- float:
%f - double:
%lf - char:
%c
You’ll learn more about these and how to use them later in the course, so don’t worry about it for now.
Keep going, you’re doing great!

Yes, C and C++ are different, though closely related. C++ is essentially an extension of the C programming language—it builds on C’s features and adds additional tools, especially object-oriented programming (OOP).
Here’s a quick breakdown:
C is a procedural programming language, meaning it focuses on functions and sequences of instructions.
C++ supports everything C does, but also includes object-oriented features like classes, inheritance, and polymorphism, which allow for more structured and reusable code.
Example in C (procedural approach):
#include
void greet() {
printf("Hello, world!");
}
int main() {
greet();
return 0;
} Same idea in C++ (with an object-oriented approach):
#include
using namespace std;
class Greeter {
public:
void greet() {
cout << "Hello, world!";
}
};
int main() {
Greeter g;
g.greet();
return 0;
} So while the basics (like variables, loops, and syntax) are very similar, C++ gives you more tools and structure—especially useful for large, complex programs.

In C programming, curly braces { } are used to define the body of functions, conditional statements, and other code blocks.
Take a look at this simple program that prints "Hello, World!":
#include
int main() {
printf("Hello, World!");
return 0;
}
In this example, the curly braces define the body of the main() function, where the actual code is executed.
If you're just starting out, I recommend you keep going through the course. It'll help you learn each concept step by step and build a solid foundation.
Hope this helps. If you need more clarification, feel free to ask. I'm happy to help.

In this code:
#include
int main() {
int count = 1;
while (count <= 3) {
printf(""I am inside a loop.\n"");
count++;
}
return 0;
} count++ increments the value of the count variable by 1.
Just note that count++ is a shorthand for count = count + 1.
If you have more questions, feel free to ask.

Yes, you need to use printf() whenever you want to output text.
Here's an example of how you would output a greeting:
printf("Hello! How are you?");
Hope this helps! If you're still confused, feel free to ask a follow-up question below.
Our Experts
Sudip BhandariHead of Growth/Marketing
Apekchhya ShresthaSenior Product Manager
Kelish RaiTechnical Content Writer
Abhilekh GautamSystem Engineer
Palistha SinghTechnical Content Writer
Sarthak BaralSenior Content Editor
Saujanya Poudel
Abhay Jajodia
Nisha SharmaTechnical Content Writer
Udayan ShakyaTechnical Content Writer