Abhay Jajodia's profileExpert

Abhay Jajodia

Answered 166 questions


About

Designer by day, web developer by night, and a full-time tech + gaming nerd in between. I'm always learning, always curious — chasing life's bonus levels, secret achievements, and power-ups like it's one big epic quest.

Answered by Abhay Jajodia
Abhay Jajodia
Expert
last year
Abhay Jajodia answered

Hi Shifa,

\n means new line.

  • If you put it before the text, it moves to a new line first, then prints the text.

    cout << "\nHello";
    
  • If you put it after the text, it prints the text first, then moves to the next line.

    cout << "Hello\n";
    

So the difference is whether the line break happens before the message or after it.

If you have more questions, I am here to help 😊

C++
This question was asked as part of the Learn C++ Basics course.
Abhay Jajodia
Expert
last year
Abhay Jajodia answered

Hi Cesar,

Self-contained content means a piece of content that can stand on its own as one complete unit.

In HTML, <figure> is used for things like an image, diagram, or code snippet plus its caption, because they belong together.

Example:

<figure>
  <img src="tiger.png" alt="Tiger">
  <figcaption>A tiger</figcaption>
</figure>

If you have more questions, I am here to help 😊

HTML
This question was asked as part of the Learn HTML course.
Abhay Jajodia
Expert
last year
Abhay Jajodia answered

Hi SELVARATHINAM,

Headings are like a content outline. <h2> is a main section, and <h3>, <h4>, <h5> are smaller sub-sections under it.

If you jump from <h2> to <h5>, it can confuse screen readers and make the page structure harder to understand. It is better to go in order, like <h2> then <h3> for the next level.

If you have more questions, I am here to help 😊

HTML
This question was asked as part of the Learn HTML course.
Abhay Jajodia
Expert
last year
Abhay Jajodia answered

Hi Onyelusi,

The <head> is for page information the browser needs, not for content the user reads on the page. Things in <head> include the page title, meta info, links to CSS, and scripts.

The content that shows on the webpage goes inside the <body>.

Example:

<head>
  <title>My Page</title>
</head>

<body>
  <h1>This will show on the page</h1>
</body>

<title> shows in the browser tab, but the <h1> shows on the actual page.

If you have more questions, I am here to help 😊

HTML
This question was asked as part of the Learn HTML course.
Roll rider Rider
last year
Rollcountry asked
Abhay Jajodia
Expert
last year
Abhay Jajodia answered

Hi Roll rider,

It should be #include <stdio.h>, not studio.h.

#include <stdio.h> adds the standard input/output library in C, so you can use functions like printf() and scanf().

If you write studio.h, the compiler cannot find that header, so you get an error.

If you have more questions, I am here to help 😊

C
This question was asked as part of the Learn C Programming course.
Abhay Jajodia
Expert
last year
Abhay Jajodia answered

Hi Steve,

Use the modulo operator %. It gives the remainder after division.

Example:

print(14 % 3)  # 2

So 14 % 3 is 2, because 14 divided by 3 leaves 2 leftover.

If you have more questions, I am here to help 😊

Python
This question was asked as part of the Getting started with Python course.
Akash Akas
last year
Akashcountry asked
Abhay Jajodia
Expert
last year
Abhay Jajodia answered

Hi Akash,

Coding matters because it lets you tell a computer what to do, so you can solve problems faster and automate boring tasks.

It also helps you build useful things like websites, apps, games, and tools, and it is a skill used in many careers.

If you have more questions, I am here to help 😊

Python
This question was asked as part of the Getting started with Python course.
Abhay Jajodia
Expert
last year
Abhay Jajodia answered

Hi Krithi,

java.util.Scanner is used to take input from the user, like reading a number or a word from the keyboard.

class Main is the main container for your program. Java code must be inside a class, and the program starts running from the main() method inside that class.

Example:

import java.util.Scanner;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int x = sc.nextInt();
    System.out.println(x);
  }
}

If you have more questions, I am here to help 😊

Java
This question was asked as part of the Learn Java Basics course.
Abhay Jajodia
Expert
last year
Abhay Jajodia answered

Hi Sujan,

Because in Python, # means comment. Anything after # on that line is only a note for humans, so Python ignores it when running the code.

Example:

# this will be skipped
print(34.0)  # this part is also skipped

Only print(34.0) runs.

If you have more questions, I am here to help 😊

Python
This question was asked as part of the Getting started with Python course.
Abhay Jajodia
Expert
last year
Abhay Jajodia answered

Hi Manfred,

Yes, you can define a function after main(). The only difference is that if main() calls that function, you should write a function prototype above main() so the compiler knows the function exists.

Example:

int findSquare(int n);  // prototype

int main() {
    printf("%d", findSquare(5));
    return 0;
}

int findSquare(int n) {  // definition after main
    return n * n;
}

If the function is defined before main(), you usually do not need the prototype.

If you have more questions, I am here to help 😊

C
This question was asked as part of the Learn C Programming course.