Тёмный

Java Tutorial: Chapter 1- Practice Set | Java Practice Problems With Solution 

CodeWithHarry
Подписаться 7 млн
Просмотров 1,3 млн
50% 1

Опубликовано:

 

26 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 2,1 тыс.   
@CodeWithHarry
@CodeWithHarry 4 года назад
Ho sake to share kar dena Java Course Ki Playlist, Please!
@GouravSharma-sn8tx
@GouravSharma-sn8tx 4 года назад
full support harry bhai
@mz7644
@mz7644 4 года назад
You r doing great work
@shortcut4275
@shortcut4275 4 года назад
First like
@juffler463
@juffler463 4 года назад
Hello bro
@SumitKumar-ho1xe
@SumitKumar-ho1xe 4 года назад
Jarur Bhai kr dunga aapke liye
@shubhammodicool
@shubhammodicool 4 года назад
Harry The things u are doing no one can do the amount of hardwork you are doing for us 🙏🏻🙏🏻🙏🏻 Hats off
@KoushikDas2005
@KoushikDas2005 Год назад
8:08 As I am from python lang. , I knew that strings can be separated inside the print statement by commas(,), but in JAVA now I came to know that + is to be given to separate two strings in the print statement. Thanks a lot for it , btw as I got error in that separation of strings I tried a new method which I want to share. System.out.print("Enter your name:"); String str1 = S.next(); System.out.print("Hello,"); System.out.print(str1); System.out.print(" Have a nice day"); Thought of making in the same line which is required in the output , which can be done by just removing ln from print statement, so I did like that. I hope if anyone is seeing can understand it along with it's essence. Thanks a lot Harry .❤❤
@equation0356
@equation0356 7 месяцев назад
Thanks bro, I came from C++ background and I have been trying to use , to separate a string and a pre defined literal. 😂 But it never worked. Today I knew we have to use + 😅❤
@Devolzgaming
@Devolzgaming Год назад
No words to say I m literally doing all programs without any doubts he is growing up all students lots of love to you Harry ❤️🧿✌🏻
@KoushikDas2005
@KoushikDas2005 Год назад
9:13 I did the same using different method , took a bool value and then checked it. Anyways , directly putting the condition in the print statement is also not bad. My answer:- System.out.println("Enter an integer:"); boolean b= S.hasNextInt(); System.out.println(b); Thanks a lot , Harry.
@ilovetech9599
@ilovetech9599 5 дней назад
System.out.println("Enter an integer:"); Scanner sc = new Scanner(System.in); boolean b= sc.hasNextInt(); System.out.println(b);
@tarabelbase8120
@tarabelbase8120 4 года назад
repect: Printf("Sir Please Continue Teaching us ."); If(Sir You continue Taching us){ HappY Teachers Day Sir ..Wish You all the best for you hard work.. And keep it up sir }else{ goto repect; }
@nirajbhagvat
@nirajbhagvat 3 года назад
Ç language
@rkbrothers1801
@rkbrothers1801 3 года назад
FEELING HAPPY AFTER COMPLETING THIS PRACTICE SET.......BECAUSE I WAS ABLE TO SOLVE MOST BY MY ONE ONLY BECAUSE OF YOU THANKS A LOT....BRO
@atharvatoundakar6118
@atharvatoundakar6118 4 года назад
REALLY I AM LEARNING MORE ON RU-vid THAN MY COLLAGE. WE ALL APPRECIATE TO YOU ABOUT YOUR WORK. FOREVER SUPPORTING!!!!!!!
@niteshshirke2077
@niteshshirke2077 2 года назад
Thanks Harry ......n..... Hats off..... Q-4 Ans System.out.println("Enter Km Value"); Scanner sc = new Scanner(System.in); float km = sc.nextFloat(); float mile = (float) 0.621371; float multiply = km * mile; System.out.println("Ans Mile : " + multiply);
@samkhangabru9932
@samkhangabru9932 9 месяцев назад
Bhai is problem ko samjha sakte ho app
@learncode6180
@learncode6180 3 года назад
Codewithharry is the best RU-vid channel among all the RU-vid channel. The way of teaching is very intuitive and understandable.
@bhupendrasinghchoudhary2980
@bhupendrasinghchoudhary2980 4 года назад
Hello harry bhai ... I'm a government employee in municipal corporation jaipur ... I'm want to tell you that how i found you ... Ek bar me MLA election duty me gaya tha wha mujhe ek banda mila usne mujhe pucha ki kya krte ho study me kya interest h to mene use bataya ki mujhe programming language padhni he jo mere liye hacking me bahit kam aayegi to usne bataya ki RU-vid pr ek channel h code with harry naam se ek bar check krna ....harry bhai tb se me aapke videos dekh rha hu or apki playlist bhi access kr rkhta hu ...you are one of my favorite ❤️
@greyhat17
@greyhat17 3 года назад
I am watching your java video just before a month .it's awesome👍👍😊😊😊 for understanding from beginners level to higher level... and I also finish half century play list both java&html-css-javascript
@KoushikDas2005
@KoushikDas2005 Год назад
8:30 Float can't be used here . As the mile conversion unit is a long decimal , so Double is to used here for our convenience. I did float input in Km to m, but it came as error in conversion of Km to miles , so I came to know of my another mistake here. System.out.println("Enter Distance in Kilometers:"); double a=S.nextDouble() ; double b = a*0.621371; System.out.println("Distance in miles is:"); System.out.println(b); Got the correct answer now. Thanks a lot, Harry brother Edit : float can also be done
@rakeshkomarolu4527
@rakeshkomarolu4527 8 месяцев назад
It's SC next double
@KoushikDas2005
@KoushikDas2005 8 месяцев назад
@@rakeshkomarolu4527 Ya I got error then there
@rakeshkomarolu4527
@rakeshkomarolu4527 8 месяцев назад
@@KoushikDas2005 u used double a = u must and should use sc next double It will come correct i think
@KoushikDas2005
@KoushikDas2005 8 месяцев назад
@@rakeshkomarolu4527 ik I changed then That's what I am saying
@KoushikDas2005
@KoushikDas2005 8 месяцев назад
@@rakeshkomarolu4527 float and double both can work
@KoushikDas2005
@KoushikDas2005 Год назад
4:17 Yes , float/double should be used . I did the same mistake when I was solving the question of last challenge (5 subjects CGPA). I then thought of the decimal answer and then converted each input into float data type. IDK why you are not taking user input process but that is the actual process which everyone should follow , although by taking direct input it will be easy for the beginners. P.S. :- I am basically used to python so there float or int , data type doesn't matter, so I generally thought if taking data input as int from the user which is wrong. Thanks .❤❤
@healthbeautytips2172
@healthbeautytips2172 4 месяца назад
Can you help me? I took input in integer and I made two variables which hold value total marks of exam and total marks obtained, then I made an integer variable to calculate percentage but when I am using int, it is showing zero everytime but when I use float then the same exact program is working, why and how? I input marks according to that it make 90 percent but it works in float but not in int 😢
@nikilsrujan7222
@nikilsrujan7222 3 года назад
System.out.println("how many number of kilometers you want to convert in miles"); Scanner s = new Scanner(System.in); double kilometers = s.nextDouble(); System.out.println("MILES =" + kilometers* 0.621); this is how i did my code . The value of miles is approximate
@neonmoton7769
@neonmoton7769 2 года назад
Why did you use double as data types ? Why not float or int ?
@harshchandel8253
@harshchandel8253 Год назад
@@neonmoton7769 same question
@nishxnteditsxd
@nishxnteditsxd 6 месяцев назад
​@@neonmoton7769??
@farheenbegum371
@farheenbegum371 4 месяца назад
Since 1 km = 0.621 , we see some decimal numbers here, by which we understood that we are going to deal with decimals in this code. So the data type related to decimals can be float or double. Tip = when finding CGPA or percentage, we know we are gonna get our answer in decimals, so for such type of questions we always use float or double.
@thatcoolkid370
@thatcoolkid370 4 года назад
Happy Teacher's Day _GURUJI_ You are the best programming Teacher of all time Thanks Thanks for JAVA playlist
@amitbarnwal4609
@amitbarnwal4609 3 года назад
Sir actually I am learning java from your video in 2021 and I had seen all the lectures and I had solve the problem which asked in lecture 5 by my own kindly look into it and correct it if l had done any error in it
@kartavayajain_3108
@kartavayajain_3108 Год назад
double km = 1; double miles = 0.621371; System.out.println("Enter kilometers"); Scanner sc = new Scanner(System.in); double kms = sc.nextDouble(); double output = kms*miles; System.out.println(output); } } It took all my brain power so i suggest revision after every letcure is must. Happy Programming😄
@bhanupandit2005
@bhanupandit2005 2 года назад
Mai paid subscription bhi le raha hu but jitna focus apki classes pr karta hu mujhe bhot ache se samjh aata hai Thankyou Sir❤️🙏
@KoushikDas2005
@KoushikDas2005 Год назад
8:26 OMG F . I had done this one as Km to m day before yesterday while practice. Going to try now. THIS IS WHY QUESTION READING SHOULD BE DONE THOROUGHLY. Sorry to myself as well as to Harry for not reading the question correctly, although I have applied the same concept there which is to be done. Going to change it now. Will come and share the answer.
@siddheshsurve6608
@siddheshsurve6608 4 года назад
Like these problems plzzzz Make this tutorial series full of placement oriented problems....🤩🤩🤩🤩🤩🤩🤩
@prolegend6198
@prolegend6198 4 года назад
8:07 Here we should use nextline instead of next as if someone enters their full name so it will only read first name
@studyport4698
@studyport4698 2 года назад
nextLine()
@aarkinshah3627
@aarkinshah3627 3 года назад
Wahh Harry bhai aapke jesa padhane wala aaj tak nahi mila. Ek bar me sab samaj aa raha hai. Thank you so much for making this playlist.
@ahmirgaming9113
@ahmirgaming9113 3 года назад
sahi baat hai bhai
@KoushikDas2005
@KoushikDas2005 Год назад
2:20 But the same can be done by taking user input . You had did the same thing while telling us about data types but it was acceptable then as we had not learnt about the user input. But as we know we should take user input (user's choice of integers), and then run the program.
@ajtheprogrammer9540
@ajtheprogrammer9540 3 года назад
Sir Excercise 1.1 help me alot for understand what you explain in previous videos. And I knew that these Practice Sets also help me for that. : ) : )
@Aditya_Vyas
@Aditya_Vyas 2 года назад
// Question 4 System.out.println("Program to convert Kilometers into Miles"); System.out.println("Enter the Number of Kilometers you want to convert into miles"); Scanner sc = new Scanner(System.in); float kilo = sc.nextInt(); float m = kilo/1.609f; System.out.println( kilo + " is converted into miles it comes to be: " + m); // Love You Harry Bhai ♥
@samirmandal5959
@samirmandal5959 2 года назад
bhai 4th lline me..... sloat kilo = sc.nextfloat(); ye likhna
@itachi_terabapp
@itachi_terabapp 2 года назад
Bhai galt ha tera program ....toone mile ko km ma kiya ha ...
@roopasuresh7413
@roopasuresh7413 2 года назад
@@itachi_terabapp bro can u tell me in 3rd program he didn't use import. Until.scanner but before when he teaching us about how to take input from keyboard he used that one reply bro
@gayatri_kolhe
@gayatri_kolhe 4 года назад
Kisamat walo ki kismat banane wale harry sir salute hai 😇😇😇
@mayuribaisvloging5996
@mayuribaisvloging5996 3 года назад
F hub.
@sivanandmishra6439
@sivanandmishra6439 Год назад
done harry bro import java.util.Scanner; public class practiceS1 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("enter the kilometer to convert"); float kilo = sc.nextFloat(); float mile = (kilo/1.609344F); System.out.println(mile + " miles"); }
@AbhishekKumar-ri2zf
@AbhishekKumar-ri2zf 4 года назад
System.out.println("Enter km which you want to convert into miles"); Scanner sc = new Scanner(System.in); float km1 = sc.nextFloat(); float aa = km1*0.621371f; System.out.println(aa);
@soumyajjaldas4319
@soumyajjaldas4319 3 года назад
bro very nice code but not the optimal use only 1 float var for solving it will be benificial for you
@jashan0924
@jashan0924 3 года назад
kro kro copy kro iska program
@darshitpatel1644
@darshitpatel1644 3 года назад
very nice bro
@nirajbhagvat
@nirajbhagvat 3 года назад
@@jashan0924 error aayega
@jashan0924
@jashan0924 3 года назад
@@nirajbhagvatlmao
@AmanLM5
@AmanLM5 4 года назад
Happy Teacher's day sir
@vedantsharma8214
@vedantsharma8214 2 года назад
I have done all with myself everything is done by your classes. I hope god will bless you!
@Billionaire-wh5fp
@Billionaire-wh5fp 9 месяцев назад
Q4 System.out.println("Enter values in kilometres:"); float a = sc.nextFloat(); float convert = a/1.609f; System.out.println("Miles will be:" + convert);
@sahiljaggarwal4994
@sahiljaggarwal4994 4 года назад
Anwser of question 4 Scanner sc = new Scanner(System.in); System.out.println("write the value of kilometer"); Float km = sc.nextFloat() Float mile = km*0621371f; System.out.println(mile + " miles");
@chitranshisingh910
@chitranshisingh910 Год назад
1st time learning java and I completed all the questions by myself, feeling confident
@aaditya_aspirant
@aaditya_aspirant 4 года назад
My school's computer teacher- Children now we are going to learn java. Me - How will i learn java now as my sir teaches only the theory part in the classes and gives practicals in exam..😢😢 Harry sir - Full java tutorial for beginners. Me - 😍😍😍😍😎 Now i can learn java very easily.
@adarshchaurasia4355
@adarshchaurasia4355 4 года назад
So true 😆😆
@shauryaagarwal6834
@shauryaagarwal6834 4 года назад
Code with Harry sir why you are not giving anyone comment a heart
@adarshchaurasia4355
@adarshchaurasia4355 4 года назад
@@shauryaagarwal6834 may be he is busy because he is conducting many courses at single time
@shauryaagarwal6834
@shauryaagarwal6834 4 года назад
@Adarah Chaurasia may be you are right
@vijayvishwakarma883
@vijayvishwakarma883 4 года назад
I am class 9 student
@shaktii2181
@shaktii2181 Год назад
I am from mechnical background, trying to learn JAVA. your videos are very helpful to understand.
@gurunehra4702
@gurunehra4702 2 года назад
5:27 or we can divide by 30f so that one out of two operands is float which will give us float output.
@gauravg4361
@gauravg4361 3 года назад
Question 4: Write a java program to covert kilometers to miles System.out.println("Enter the value in kilometers"); Scanner sc = new Scanner(System.in); double value = sc.nextInt(); double miles = (value/1.609); System.out.println("The value in miles is " + miles + " miles");
@prashantmalviya7764
@prashantmalviya7764 2 года назад
sc.nextDouble(); , Kindly correct it
@sadhusanjay5547
@sadhusanjay5547 2 года назад
bro miles me 1.609 kese aaya ??
@krishnagod1233
@krishnagod1233 2 года назад
It is sc.nextDouble
@dhyeypadia7417
@dhyeypadia7417 2 года назад
@@sadhusanjay5547 1km=1.609 miles
@rushikeshyadav3801
@rushikeshyadav3801 2 года назад
@@dhyeypadia7417 Bhai 1 mile = 1.609 km hota hai
@adarshshukla2792
@adarshshukla2792 4 года назад
Happy teacher's day sir ❤️🙏
@Berozgaar35
@Berozgaar35 2 года назад
time stamp : 8:24 import java.util.Scanner; public class Main { public static void main(String[] args) { float kilo,miles; Scanner sc = new Scanner(System.in); System.out.println("enter the kilometers"); kilo=sc.nextFloat(); System.out.println("Conversion begins : "); miles=kilo*0.62137119f; System.out.print(miles); } }
@siddhant886
@siddhant886 7 месяцев назад
plzzz expalin me how to build a login
@Berozgaar35
@Berozgaar35 7 месяцев назад
@@siddhant886 bhai ab to muje bhi nhi aata😂😂
@siddhant886
@siddhant886 7 месяцев назад
@@Berozgaar35 😭🥲
@ayn33as
@ayn33as 6 месяцев назад
Bhai error show kyo ho raha hai
@izzu-u9e
@izzu-u9e 4 месяца назад
​@@siddhant886 Bht easy hai bhai...ap km to miles conversion formula google se dekhey or Wohi formula use krein...or jis variable k ander calculation store kia us variable ko print krva dey
@KoushikDasMagnate2005
@KoushikDasMagnate2005 Год назад
7 August Completing in a row with revision . Will complete it ASAP and move on . Already wasted a lot of time on this , basic course , which is made for kids only. No hate but after using for a month , I realized that CWH is known for making content which are helpful for kids. Thanks Harry...
@lakshmibai2348
@lakshmibai2348 2 года назад
We can type .0f after that 30. Writing .0f gives the result in decimals
@not-in-sync4119
@not-in-sync4119 2 года назад
4th Quetion : My approach :) import java.util.Scanner; public class Main{ public static void main(String[] args){ System.out.println("Enter the value in kilometers"); Scanner sc = new Scanner(System.in); double km = sc.nextDouble(); double mile = (km/1.609); System.out.println("The value of Kilometers in miles is "+ mile); } }
@repandroar
@repandroar 2 года назад
@Mayank Bhadauria +1
@poojatailor6952
@poojatailor6952 3 года назад
I have shared this playlist to all of my classmates and friends. It is so fun to learn java through this playlist.
@parthpatel7210
@parthpatel7210 4 года назад
Heartly Wishes Happy Teacher's Day My Sir Programmer
@KoushikDas2005
@KoushikDas2005 Год назад
8:35 Here I have used another logic i.e. I have taken user input , then stored boolean b= sc.hasNextInt() , then System.out.println(b). And got the same result .
@IITianTaniya
@IITianTaniya Год назад
Homework done sir ☺ Question 4: System.out.println("convert kilometer into miles"); System.out.println("Enter kilometer"); Scanner sc = new Scanner(System.in); float input = sc.nextFloat(); float multiple = (input)*0.621371f; System.out.println(multiple);
@pulkitsingh8234
@pulkitsingh8234 Год назад
Sout("enter number for conversion") float number = sc.nextFloat() Sout (number * 0.667) } }
@sheetalgupta1573
@sheetalgupta1573 4 года назад
A good teacher is like a candle it consumes itself to light the way for others. Thank you harry bhai for making such videos and happy teachers day
@codefun9646
@codefun9646 4 года назад
Yes
@QasimKhan-io9wj
@QasimKhan-io9wj 4 года назад
// Question 4 System.out.println("Kilometers to miles"); Double miles = 0.621371; Double km = 1.00; Scanner sc = new Scanner(System.in); System.out.println("enter kilometers"); double input = sc.nextDouble(); Double tMiles = (input)*0.621371; System.out.println(input+" kilometer = "+ tMiles+ " Miles");
@Who_am_i.....245
@Who_am_i.....245 Год назад
Where is syntax 💀
@peerbuxlaghari7084
@peerbuxlaghari7084 10 месяцев назад
chatgpt zindabadd😄😄
@dwaipayanbiswas3864
@dwaipayanbiswas3864 2 года назад
Question No.4 :- import java.util.Scanner; public class CWH_Ch1_PS2 { public static void main(String[] args){ System.out.println("Enter The Kilometers "); Scanner sc = new Scanner(System.in); float km = sc.nextFloat(); float miles = (float) (km/1.609); System.out.println("The Kilometers in Miles is" + miles + " Miles");
@LostboyK79
@LostboyK79 Год назад
use f at the last of number. or use double as variable
@sharannarsingi7578
@sharannarsingi7578 Год назад
@@LostboyK79 double as datatype*
@sumayamohammed7147
@sumayamohammed7147 3 месяца назад
// 1 km = 0.621371 float miles = km*0.621371f; System.out.println(miles); Easier ones👆
@kingkumar007
@kingkumar007 Год назад
It's working 😊😊 import java.util.Scanner; public class KING_06 { public static void main(String[ ] args) { System.out.println("Change Kilometer into Miles"); Scanner sc = new Scanner(System.in); double kilo = sc.nextDouble( ); double miles = (kilo)*0.621371; System.out.println(miles); } }
@Aashee0009
@Aashee0009 4 месяца назад
Hello harry bhaiya maine sare question apne se banaya pahle ek do bar error aaya par last me sare question bna liye thank you so much bhaiya aapne itne achhe se samjhaya 😊
@himankjeshwar8636
@himankjeshwar8636 2 года назад
8:29 - Question 4 Here is the code , import java.util.Scanner; public class Length { public static void main (String[ ] args) { Scanner k = new Scanner (System.in); System.out.print("Enter Length in Kilometers = "); double kilometers = k.nextDouble(); double miles = kilometers/1.609; System.out.println("Length in miles = "+miles+" mi"); } }
@suyogghodake9505
@suyogghodake9505 Год назад
👍👍
@suyogghodake9505
@suyogghodake9505 Год назад
{ Scanner sc4 = new Scanner(System.in); System.iut.println("Enter your Kilometers "); float KM = sc4.next(); double Miles = KM * 0.6213712; System.out.println(Conversation of KM to Miles is"); }
@Render_Gaming07
@Render_Gaming07 Год назад
sir humne int data type ka use kiya h and int data type is onl;y for integer that"s why its output is an integer. We have to use Double data type. thnks a lot sir #CodeWithHarry❤
@ALIKHAN-ug3xc
@ALIKHAN-ug3xc 3 года назад
Great teacher. A lots of respect.
@aseembhardwaj9099
@aseembhardwaj9099 3 года назад
Hello harry sir! I just want to ask that the CGPA of the numbers (in the seventh video) is equal to: 7.33 because the grade point for 49=6 ; that for 95= 10; & that for 48 = 6 .so when we add ie. 6+10+6 and divide it by 3 we get 7.333333333. am I correct?
@ivikrantraj
@ivikrantraj 2 года назад
Yes
@Rocky-ls1td
@Rocky-ls1td 2 года назад
Harry bhai aapne question 5 waala concept (system.out.println(sc.hasnextInt());) toh pehle btaya nhi ki kaise use krna h.. BTW I love ❤️ this playlist 😇🙌🏻.
@ksdhillon9449
@ksdhillon9449 4 года назад
Import java.util.Scanner ; class Main { public static void main(String[] args) { System.out.println(" km into miles"); Scanner km = new Scanner(System.in); System.out.println("kilometers here"); float a = km.nextFloat(); System.out.println(a /1.609); } }
@sangyanfoundation8814
@sangyanfoundation8814 3 года назад
a*62137 hoga conversion me bhai
@mohammedputhawala5055
@mohammedputhawala5055 4 года назад
Happy teachers day sir. The best channel ❤❤
@ranjanjyoti273
@ranjanjyoti273 3 года назад
Hi Harry, You are doing a very fantastic job .Keep it up Bro .Could you please create tutorials on Java collection ?
@_Spread_Positivity_
@_Spread_Positivity_ Год назад
practice 1 and 2 are very easy i can do it orally now thanks harry Practice set 3 here is the code i wrote import java.util.Scanner; public class practiceSet1 { public static void main(String[] args) { Scanner scanningName = new Scanner(System.in); System.out.print("Enter Your name: "); String name = scanningName.next(); System.out.println(" "); System.out.print("Hello "); System.out.print(name); System.out.print(" have a good day"); } }
@भूकंप
@भूकंप Год назад
you can enter output in one line- System.out.println("hello " + + "have a good day")
@krishKalavadia
@krishKalavadia Год назад
Hello! Bro first of all thank you so much for teaching me java so well not just for java. If I have any question, I immediately go to your channel and solve the doubt. Thanks once again bro love you. import java.util.Scanner; public class percentage { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("Enter the Mathematics Marks"); int M = sc.nextInt(); System.out.println("Enter the Science Marks"); int S = sc.nextInt(); System.out.println("Enter the Physics Marks"); int P = sc.nextInt(); System.out.println("Enter the Chemistry Marks"); int C = sc.nextInt(); System.out.println("Enter the English Marks"); int E = sc.nextInt(); System.out.println("Enter the Sanskrit Marks"); int F = sc.nextInt(); System.out.println("percentage of Student"); float B = (M + S + P + C + E + F) / 6f; System.out.println(B); System.out.println("Enter Student name"); String name = sc.next(); if (B > 30){ System.out.println("\u001B[92m" + "Hello " + name + " Congratulation You have a pass this exam 😀!"); } else { System.out.println("\u001B[91m" + "Hello " + name + " You have a Fail this exam ☹!"); } } }
@KnowledgeWorld-LetsLearn
@KnowledgeWorld-LetsLearn 3 года назад
My code to convert kilometers to miles:- System.out.println("Enter value of kilometers:- "); Scanner sc = new Scanner(System.in); int KM = sc.nextInt(); float miles = 0.62f; System.out.println(KM + " Kilometers is equal to: " + KM*miles + " miles");
@suhanipachouri5416
@suhanipachouri5416 3 года назад
Why do we use 0.62f,Can you explain why?
@KnowledgeWorld-LetsLearn
@KnowledgeWorld-LetsLearn 3 года назад
@@suhanipachouri5416 0.62f coz 1km = 0.62 miles, and the "f" (0.62f) because java understands that the variable is a float when we add the letter f in the end... 🙂
@aryantiwari1782
@aryantiwari1782 3 года назад
Hi ! Why haven’t you defined the scanner function ie: (import java.util.Scanner ) before public class , as u have directly created the object of scanner in main function
@GYM_LOVER-q5r
@GYM_LOVER-q5r 2 года назад
Exactly
@awiralchhetri2600
@awiralchhetri2600 Год назад
The import function is used when taking input from the user.
@vinayakchavan5142
@vinayakchavan5142 2 года назад
Question4 Sout("Enter a kilometers); Scanner sc = new Scanner(System.in); double d1 = sc.nextDouble(); double miles = d1*62137; sout(miles)
@shivasabale6554
@shivasabale6554 2 года назад
double hi Q use kiya yahapr
@mymemory2782
@mymemory2782 2 года назад
@@shivasabale6554 bhai tum float bhi use kar saktai ho,,, baas double point kai baad bhi bhaut digit store karta hai
@manojrawat2785
@manojrawat2785 2 года назад
Here should be 0.62137
@Jvalpatel_1011
@Jvalpatel_1011 2 года назад
@@mymemory2782 Float leke miles (value/1.609) krte error atti hee Double best option
@mohitmechanicalengineering9607
@mohitmechanicalengineering9607 2 года назад
@@Jvalpatel_1011 bhai 1 km = 0.62317 miles,F1 /0.62317; use kr ke try kro ?
@PratyushTripathy-p7u
@PratyushTripathy-p7u Месяц назад
//Question 1 public class PracticeSet1 { public static void main(String[]Args){ int a = 100; int b = 250; int c = 900; int sum = a + b + c; System.out.println("The sum of the three numbers is :"); System.out.println(sum); } } Output : "C:\Program Files\Java\jdk-22\bin\java.exe" "-javaagent:C:\Users\PRATYUSH TRIPATHY\AppData\Local\Programs\IntelliJ IDEA Community Edition\lib\idea_rt.jar=54713:C:\Users\PRATYUSH TRIPATHY\AppData\Local\Programs\IntelliJ IDEA Community Edition\bin" -Dfile.encoding=UTF-8 -Dsun.stdout.encoding=UTF-8 -Dsun.stderr.encoding=UTF-8 -classpath "C:\Users\PRATYUSH TRIPATHY\IdeaProjects\JAVA\out\production\JAVA" PracticeSet1 The sum of the three numbers is : 1250 Process finished with exit code 0 //Question 2 public class PracticeSet1 { public static void main(String[]Args){ float physics = 90; float chemistry = 70; float maths = 75; float cgpa = (physics + chemistry + maths)/30; System.out.println("The cgpa is :"); System.out.println(cgpa); } } "C:\Program Files\Java\jdk-22\bin\java.exe" "-javaagent:C:\Users\PRATYUSH TRIPATHY\AppData\Local\Programs\IntelliJ IDEA Community Edition\lib\idea_rt.jar=55272:C:\Users\PRATYUSH TRIPATHY\AppData\Local\Programs\IntelliJ IDEA Community Edition\bin" -Dfile.encoding=UTF-8 -Dsun.stdout.encoding=UTF-8 -Dsun.stderr.encoding=UTF-8 -classpath "C:\Users\PRATYUSH TRIPATHY\IdeaProjects\JAVA\out\production\JAVA" PracticeSet1 The cgpa is : 7.8333335 Process finished with exit code 0 //Question 3 import java.util.*; public class PracticeSet1 { public static void main(String[]Args){ System.out.println("What is your name ??"); Scanner sc = new Scanner(System.in); String name = sc.next(); System.out.println(" Hello " + name + " have a good day. "); } } Output : "C:\Program Files\Java\jdk-22\bin\java.exe" "-javaagent:C:\Users\PRATYUSH TRIPATHY\AppData\Local\Programs\IntelliJ IDEA Community Edition\lib\idea_rt.jar=55631:C:\Users\PRATYUSH TRIPATHY\AppData\Local\Programs\IntelliJ IDEA Community Edition\bin" -Dfile.encoding=UTF-8 -Dsun.stdout.encoding=UTF-8 -Dsun.stderr.encoding=UTF-8 -classpath "C:\Users\PRATYUSH TRIPATHY\IdeaProjects\JAVA\out\production\JAVA" PracticeSet1 What is your name ?? Ram Hello Ram have a good day. Process finished with exit code 0 // Question 4 import java.util.*; public class PracticeSet1 { public static void main(String[]Args){ System.out.println("Enter distance in kilometers :"); Scanner sc = new Scanner(System.in); float km = sc.nextFloat(); float miles = km*0.62137119F; System.out.println("The result of the conversion is :"); System.out.println(miles); } } Output : "C:\Program Files\Java\jdk-22\bin\java.exe" "-javaagent:C:\Users\PRATYUSH TRIPATHY\AppData\Local\Programs\IntelliJ IDEA Community Edition\lib\idea_rt.jar=56009:C:\Users\PRATYUSH TRIPATHY\AppData\Local\Programs\IntelliJ IDEA Community Edition\bin" -Dfile.encoding=UTF-8 -Dsun.stdout.encoding=UTF-8 -Dsun.stderr.encoding=UTF-8 -classpath "C:\Users\PRATYUSH TRIPATHY\IdeaProjects\JAVA\out\production\JAVA" PracticeSet1 Enter distance in kilometers : 10 The result of the conversion is : 6.213712 Process finished with exit code 0 // Question 5 import java.util.*; public class PracticeSet1 { public static void main(String[]Args){ Scanner sc = new Scanner(System.in); System.out.println("Enter your number :"); System.out.println(sc.hasNextInt()); } } Output : "C:\Program Files\Java\jdk-22\bin\java.exe" "-javaagent:C:\Users\PRATYUSH TRIPATHY\AppData\Local\Programs\IntelliJ IDEA Community Edition\lib\idea_rt.jar=56250:C:\Users\PRATYUSH TRIPATHY\AppData\Local\Programs\IntelliJ IDEA Community Edition\bin" -Dfile.encoding=UTF-8 -Dsun.stdout.encoding=UTF-8 -Dsun.stderr.encoding=UTF-8 -classpath "C:\Users\PRATYUSH TRIPATHY\IdeaProjects\JAVA\out\production\JAVA" PracticeSet1 Enter your number : 40 true Process finished with exit code 0
@bismoybiswas9204
@bismoybiswas9204 8 месяцев назад
Hi Harry! I just started Java Programming by viewing this playlist. And I had done Question 4 by this type // Question 4 System.out.println("Write in Kilometers: "); Scanner sc=new Scanner(System.in); double Km= sc.nextDouble(); double Miles=Km*0.62; System.out.println("You have to go "+Miles+" miles more"); And O/p comes: Write in Kilometers: 8.75 You have to go more 5.425 miles Process finished with exit code 0
@kush3723
@kush3723 2 года назад
thank you so much for videos here is my solution.. import java.util.Scanner; public class marksintopercentage { public static void main(String[] arg) { System.out.println("Enter marks of 5 subjects"); Scanner sc=new Scanner(System.in); System.out.println("enter marks of 1st subject"); float a = sc.nextFloat(); System.out.println("enter marks of 2nd subject"); float b = sc.nextFloat(); System.out.println("enter marks of 3rd subject"); float c = sc.nextFloat(); System.out.println("enter marks of 4th subject"); float d = sc.nextFloat(); System.out.println("enter marks of 5th subject"); float e = sc.nextFloat(); System.out.println("enter maximum marks"); float g= sc.nextFloat(); float marks = g*5; System.out.println("the percentage of student is "+(((a+b+c+d+e)/marks)*100+"%")); } }
@tanishajaiswal7559
@tanishajaiswal7559 4 года назад
Thanks for this amazing course
@abdullah6055
@abdullah6055 3 года назад
System.out.println("And I will see you next time");
@programmerpro635
@programmerpro635 4 года назад
Thank a lot sir, I started my programming journey been inspired by you and you have taught me so much. Happy teachers day 🎉♥️♥️
@himanshumohod9467
@himanshumohod9467 5 месяцев назад
For calculating cgpa we simply have to divide percentage by 9.5 As mentioned in google
@KoushikDas2005
@KoushikDas2005 Год назад
4:34 total marks is 300 , so 100 is to be multiplied so here it's a mistake . I think . If it's to be done in correct way I think just divide the total marks secured by 3 . So, simple. And here I had also done this mistake, I had not taken float at first but then I changed the whole program into float user inputs.
@navednk8329
@navednk8329 2 года назад
// practice set 1 Q4 import java.util.Scanner; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); System.out.println("Enter kilometres Covered"); float km = sc.nextFloat(); System.out.println(km); double miles = km * 0.621371; System.out.println("You Have Covered " + miles + " miles"); } }
@shauryagrewal403
@shauryagrewal403 2 года назад
// Question 4 // Kilometres to miles // float mile = 0.6214f; // System.out.println("Write the value in kms which you want to convert into miles"); // Scanner sc = new Scanner(System.in); // float km = sc.nextInt(); // float ans = km*mile; // System.out.println(km + " km in miles = " + ans);
@SanjaySoni-mq4jf
@SanjaySoni-mq4jf 2 года назад
Bro there should be nextFloat Or next double :(
@architjain7071
@architjain7071 4 года назад
The solutions of practise set : The solutions of answer number 1: package java_programming; import java.util.Scanner; public class hello { public static void main(String[] args) { Scanner s=new Scanner (System.in); System.out.print("enter your first number: "); int a=s.nextInt(); System.out.print("enter your second number: "); int b=s.nextInt(); System.out.print("enter your third number: "); int c=s.nextInt(); System.out.print("sum of three numbers is: "); System.out.print(a+b+c); s.close(); } } the answer of question number 4 is: package java_programming; import java.util.Scanner; public class hello { public static void main(String[] args) { Scanner s= new Scanner(System.in); System.out.print("enter distance (in km): "); int a= s.nextInt(); System.out.print(a); System.out.print(" km is equal to "); System.out.print(a*0.62137119224); System.out.print(" miles."); s.close(); } } the answer of question number 5 is: package java_programming; import java.util.Scanner; public class hello { public static void main(String[] args) { Scanner s= new Scanner(System.in); System.out.print("enter your number:"); int num = s.nextInt(); System.out.print("you entered an integer."); s.close(); } } the answer of question no 3 is: package java_programming; import java.util.Scanner; public class hello { public static void main(String[] args) { Scanner s= new Scanner(System.in); System.out.print("enter your name:"); String str = s.next(); System.out.print("Hello "+str+" ,have a good day."); s.close(); } } the answer of question number 2 is: package java_programming; import java.util.Scanner; public class hello { public static void main(String[] args) { Scanner s=new Scanner (System.in); System.out.print("enter your first subject: "); int a=s.nextInt(); System.out.print("enter your second subject: "); int b=s.nextInt(); System.out.print("enter your third subject: "); int c=s.nextInt(); System.out.print("cgpa is: "); System.out.print((a+b+c)/30.0); s.close(); } }
@KoushikDas2005
@KoushikDas2005 Год назад
6:30 I didn't know about how to concatenate strings in JAVA while printing , so I used a different logic for it. Just removed ln from System.out.println() , then printed Hello , then, str(My name being stored in it), then again in another print statement , the rest of it. So, all of them came in a similar manner P.S. :- In python, it was , whereas here it's +
@KoushikDasMagnate2005
@KoushikDasMagnate2005 Год назад
14 August Complete in one go (Trying second time after inconsistency )
@shiveshkushwaha204
@shiveshkushwaha204 4 года назад
Challenge Accepted Solution : - // Question4 System.out.println("Enter the value of Miles"); Scanner sc = new Scanner(System.in); Double Miles = sc.nextDouble(); Double kiloMeteres = 1.60934; Double Value = (kiloMeteres*Miles); System.out.println(Value);
@shremishra8954
@shremishra8954 2 года назад
Sir question 4 ?
@bhagyakanojia5362
@bhagyakanojia5362 5 месяцев назад
Easy he bass formula lgana he
@NarendraPrajapati-gv4ty
@NarendraPrajapati-gv4ty 5 месяцев назад
System.out.println("enter the value"); float a = sc.nextFloat(); double miles = a*0.621; System.out.print("the value of km in miles is = "); System.out.print(miles); Thanks me later😅
@fakesmile8437
@fakesmile8437 5 месяцев назад
​@@NarendraPrajapati-gv4tythanks dude.. I just want to see formula 😊 . .. Thanks alot
@NarendraPrajapati-gv4ty
@NarendraPrajapati-gv4ty 5 месяцев назад
@@fakesmile8437 wlcm bro
@idealco.3451
@idealco.3451 2 года назад
ALL FIVE QUESTION ANSWERS: Q1:) import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.print("Enter first number:"); int s1 = sc.nextInt(); System.out.print("Enter second number:"); int s2 = sc.nextInt(); System.out.print("Enter third number:"); int s3 = sc.nextInt(); int sum = s1+s2+s3; System.out.println("sum of three number is:" +sum); } } Q2:) import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.print("Enter first subject marks:"); float s1 = sc.nextInt(); System.out.print("Enter second subject marks:"); float s2 = sc.nextInt(); System.out.print("Enter third subject marks:"); float s3 = sc.nextInt(); float cgpa = (s1+s2+s3)/30; System.out.println("cgpa is:" +cgpa); } } Q3:) import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.print("Enter your name:"); String name = sc.next(); System.out.print("Hello " +name +" have a good day"); } } Q4:) import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.print("Enter distance(in km):"); int km = sc.nextInt(); double miles=km * 0.621371; System.out.print("distance (in miles) is :" +miles); } } Q5:) import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.print("Enter a number:"); Boolean num = sc.hasNextInt(); System.out.print(num); } }
@niteshch9166
@niteshch9166 2 года назад
import java.util.Scanner; public class practise{ public static void main(String [] args){ Scanner sc = new Scanner(System.in); System.out.println("Enter length in kilometer:"); double km = sc.nextDouble(); double miles = (km/1.609); System.out.println("The length in miles is " +miles); } } This is the solution of question no 4 sir!
@crazyhunter.6674
@crazyhunter.6674 2 года назад
Java cource Grand success Helping students like me♥️
@functiondance8204
@functiondance8204 Год назад
package praticeset1; import java.util.Scanner; public class kmtomiles { public static void main(String[] args) { // TODO Auto-generated method stub System.out.println("enter km"); Scanner s=new Scanner(System.in); double km=s.nextDouble(); double any=(km*0.62137); System.out.println(any); } } //4 number question ans
@HackingWallah
@HackingWallah Год назад
import java.util.*; class km2miles { public static void main(String args[]) { Scanner sc = new Scanner(System.in); System.out.println("Enter a number"); double km = sc.nextDouble(); double mile =(km*0.62137); System.out.println(mile); } } // Question No. 4
@jashanpreet8646
@jashanpreet8646 4 года назад
Kon kon chahata hai ki harry bhai apni lifestyle par video banae
@rishabpant2391
@rishabpant2391 4 года назад
Mai Chahata hu
@socialmediagyan1649
@socialmediagyan1649 4 года назад
Mai chahata hu
@jashmohan
@jashmohan 4 года назад
Mai chahata hu
@Shraddhaz_Guitar_Vibes
@Shraddhaz_Guitar_Vibes Год назад
Dusro ki lifestyle dekh ke kya hi kroge ??!!!
@zartashumarvirk5325
@zartashumarvirk5325 6 месяцев назад
Bro you focus on your goals not another's life 😊
@a4anasofficial512
@a4anasofficial512 3 месяца назад
Watching it 3 years after Hats off to you Harry Bhai
@sadaf3636
@sadaf3636 4 года назад
The dislkes are from computer Teachers😂
@veerpallchauhan2876
@veerpallchauhan2876 3 года назад
Agree
@mayankvikash
@mayankvikash 2 года назад
Thanks Harry for this series, Next year I will give my boards.
@Harshits27
@Harshits27 11 месяцев назад
Day 1 challenge completed 😊
@kandesrihari3683
@kandesrihari3683 2 года назад
Does the cgpa formula said by Harry is right or wrong
@arghojitsaha3568
@arghojitsaha3568 2 года назад
Sir saare khud se solve ho gaaye...bohot aacha padhate ho aap😊
@Billionaire-wh5fp
@Billionaire-wh5fp 9 месяцев назад
01:20 Share a practice set for Java with solution 02:40 Practice problems in chapter 1 involve summing 3 numbers. 04:00 Calculate CGPA for 3 subjects with Java programming 05:20 Dividing integer by integer yields integer result 06:40 Floating point numbers are used to handle decimal results 08:00 Create a Java program to ask for user's name and greet 09:20 Demonstration of concatenation in Java and basic string operations. 10:36 Determining if an integer is present in the input
@Shyamji__YT
@Shyamji__YT 2 года назад
public static void main(String[] args) //question 4 System.out.println (^ convert kilometers to miles "); Scanner s = new Scanner (sys ); System.out.println(" enter km^ n ); float a = oat(); double b = (a/1.609); System.out.println(b);
@factstage1977
@factstage1977 2 года назад
4:45 min Because int likha hua h Agar float ya double ka use kia jayega tb hi decimal me show krega
@ashwinisingh8385
@ashwinisingh8385 2 месяца назад
public class Harry{ public static void main (String[]args){ System.out.println("Harry Bhai is Great"); } }
@notesallaince2214
@notesallaince2214 Год назад
// QUESTION 2; double num1 = 85; double num2 = 67; double num3 = 45; double cgpa = (num1+num2+num3)/3; System.out.println(cgpa); // We can use double also in place of float
@factmania0803
@factmania0803 Год назад
bro one mistake you/3 but its 30; correct that
@MeeraTech_Talks
@MeeraTech_Talks 2 года назад
Thank you bhai....very nice video....it's so helpful for me i can't afford coaching...so thank you u r the best teacher
@heavenhuman4734
@heavenhuman4734 2 года назад
System.out.print("Enter the km to change in mile "); float km = sc.nextInt(); float mile = km/1.6f; System.out.print( km + " km = " + mile + " mile");
@Anowarul58
@Anowarul58 2 года назад
Hi, Harry. As i am a beginner, and firs time i am learning java. so what ever code I have written by myself. Please correct me if I am wrong. package CHW_05_Exercise; import java.util.Scanner; public class ScannerClass { public static void main(String[] args) { Scanner student = new Scanner(System.in); System.out.print("The mark of the student in english :"); int eng = student.nextInt(); System.out.print("The mark of the student in science :"); int sci = student.nextInt(); System.out.print("The mark of the student in mathematics :"); int math = student.nextInt(); System.out.print("The mark of the student in social :"); int social = student.nextInt(); System.out.print("The mark of the student in assamese :"); int ass = student.nextInt(); System.out.print("The mark of the student in Total marks :"); int total = student.nextInt(); System.out.print("The mark for each subject is :"); int eachSub = student.nextInt(); float a = (eng + sci + math + social + ass); float b = a / total; float percentage = b * eachSub; System.out.println("The percentage of the student is :" + percentage); } }
Далее
Solve Any Pattern Question With This Trick!
57:20
Просмотров 2,4 млн
Китайка и Красивые Глаза😂😆
00:20
Inside Delhi’s Worst Slums ft. Medha | Jist
31:21
Просмотров 105 тыс.
Java Tutorial: Practice Questions on Arrays in Java
48:43
Java Tutorial: Getting User Input in Java
15:38
Просмотров 2 млн