Digits of a number - Solution | Java Foundation Course | Lecture 19

preview_player
Показать описание
Question Name:
Digits of a number

Question Link:

Question Statement:
1. You've to display the digits of a number.
2. Take as input "n", the number for which digits have to be displayed.
3. Print the digits of the number line-wise.

--------------------------------------------------------------------------------------------------------------------------------------------------------------

--------------------------------------------------------------------------------------------------------------------------------------------------------------

Pepcoding has taken the initiative to provide counselling and learning resources to all curious, skillful and dedicated Indian coders. This video is part of the series to impart industry-level web development and programming skills in the community.

We also provide professional courses with live classes and placement opportunities.

DSA Level 1 and Level 2

We are also available on the following social media platforms: -

HAPPY PROGRAMMING!
Pep it up.....

Hashtags

#java #javafoundation #digitsofanumber
Рекомендации по теме
Комментарии
Автор

Thanks a lot! I never thinked this depth before coding you have made me to go above and beyond the level I code Looking forward to more of your videos thank you!

deepjoshi
Автор

this is the best thing you have that mistakes happen by everybody but other youtube teachers crop that part and you don't do that
such a great teacher

KaalHarMahadev
Автор

This question is simple, but it teaches me how to think deeply for solving problems. Thanks sir ji... still best course in 2025

sunilkumar_vlogs
Автор

we can simply convert the integer to string and print the lenght line wise

Kafi_relatable
Автор

❤❤❤better than most of the Paid Courses

anonymous_aadmi
Автор

Why to use 'temp' instead on 'n' in number of digits in a number loop... When I am using just 'n' my result is 0.
Anybody has answer?

nishant_bhardwaj
Автор

Sir iss questions me pehale zero Hoga toh ye error aarha hai

PrinceRaj-tmrv
Автор

Sir where is your compiler where you write your code
I have checked the java foundation course open compiler but it's not like that
Mean when I use scanner class it throws error

dhanrajpatil
Автор

sir agar aap suru se dry run karke dikha skte hai to or ache se smjh ata

AdityaSingh-imiv
Автор

String numString=String.valueOf(n);
int length=numString.length();
for (int i=0;i<length;i++) {


}

divyanshupandey
Автор

why pow(10, 2) give 99 instead of 100 when used to store in int, this same goes for 2, 4, 8 exponents but not for 6 like pow(10, 4) give 9999 and pow(10, 6) give and again pow(10, 8)give (c++) why?

abhishekbhadauriya
Автор

sir thoda basics to bhi bta diya kriye hm log begginers hain sb upr se jata hai for example intmath.pow ye nhi smjh aa khn se use kis liye use hua

adnanmakkiofficial
Автор

any one can tell me why sir used n=n%div; in second loop. please tell me.

justseethis-
Автор

private static List<Integer> getTheDigits(int num)
{
ArrayList<Integer> allData = new ArrayList<>();
while (num>0)
{
//% will always gives us remainder
allData.add(0, num %10);
num = num /10;
}
return allData;
}

sir..is it okay to do like this

deeptomar
Автор

Mza agya sir ye q krke, dimaag khulgya

mohitratanpal
Автор

Sir I have used for loop in this and it shows time limit exceeded

slowedReverbJunction
Автор

n = int(input())
why this line is giving error in python editor? any ideas guys?

adityawable
Автор

Sir how to write div = 10^nod-1; in c++

RishabhSharma-tprs
Автор

sir i am not able to solve the questions without watching the solution video.
is it normal if yes
then kindly guide me to overcome this.

tejaswikumar
Автор

Sir this is how i did it:

import java.util.*;
import java.lang.Integer;
public class Main{

public static void main(String[] args) {

Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
String s = Integer.toString(n);
for(int i = 0 ; i <s.length();i++){

}
}
}

gurpreetsinghdua
join shbcf.ru