Java Tutorial: Practice Questions on Java Methods

  Рет қаралды 440,837

CodeWithHarry

CodeWithHarry

Күн бұрын

Пікірлер: 1 200
@CodeWithHarry
@CodeWithHarry 4 жыл бұрын
Ho sake to insta pe share karo ye playlist 🙏🏻🙏🏻 If you share this playlist, make sure to tag me in your Instagram story. Instagram: instagram.com/codewithharry
@vinayak5788
@vinayak5788 4 жыл бұрын
Love You Harry Bhai :) You are the best
@akashrajiwale764
@akashrajiwale764 4 жыл бұрын
Harry sir data structure ka full tutorial plzz (for beginners)
@supriyalonkar449
@supriyalonkar449 4 жыл бұрын
OK
@surajundrekar9604
@surajundrekar9604 4 жыл бұрын
Bro please solve my problem modulenotfounderror: no module named 'urllib3 please give solution please please
@ramsagarsingh544
@ramsagarsingh544 4 жыл бұрын
Thnx
@prajwalm.s7976
@prajwalm.s7976 3 жыл бұрын
13:46 public class StarPattern { static void pattern(int n){ for (int i = 0; ii;j--){ System.out.print("*"); } System.out.println(); } } public static void main(String[] args) { pattern(4); } }
@AshishKhetwal
@AshishKhetwal 8 ай бұрын
thanks
@aritradas8420
@aritradas8420 4 ай бұрын
Thanks bro🎉🎉
@gamershub9219
@gamershub9219 2 ай бұрын
Bhai Maine i-- or j++ chalaya
@himanshigupta9641
@himanshigupta9641 3 жыл бұрын
These practice sets makes every question clear...!!!.Your efforts are highly appreciated sir.
@pawannane1540
@pawannane1540 3 жыл бұрын
20:19 static void reverse_pattern_recursion(int n){ if (n == 0) { return; } for (int i = 0; i < n; i++) { System.out.print("* "); } System.out.println(); reverse_pattern_recursion(n - 1); }
@balboa7
@balboa7 2 жыл бұрын
Thanks for the help. Earlier , I knew the logic, but when i tried, i was getting infinite loop. Anyways thanks
@harshit0203
@harshit0203 2 жыл бұрын
13:44 QUESTION 4: static void pattern2(int n){ for ( int i = 0; ii ; j--){ System.out.print("*"); } System.out.println(""); } } // Under main method: pattern2(4);
@Prototype.abdullah
@Prototype.abdullah 2 жыл бұрын
return type
@Oksirthankyou
@Oksirthankyou Жыл бұрын
Using recursion
@PROGRAMMER_CODER
@PROGRAMMER_CODER 2 жыл бұрын
29:00 static double temperature(float c){ return (c*1.8)+32; } public static void main(String[] args) { Scanner T=new Scanner(System.in); System.out.print("Enter The value of Celsius(C) : "); float t= T.nextFloat(); System.out.println("Celsius to Fahrenheit Temperature is : "+temperature(t)+" F"); }
@RishitaTomar-ku8ob
@RishitaTomar-ku8ob Жыл бұрын
👍
@kishanpatel1264
@kishanpatel1264 4 жыл бұрын
Arre yaar kitni mehnat karte ho tum bhai. 2 videos in a day. Ek hi to dil hai kitni bar le jaonge yaar. Thank you very very much.
@hritwiksaha5657
@hritwiksaha5657 3 жыл бұрын
13:20 problem 4 required method: static void pattern2(int n){ for(int i=0;i
@joysaha7424
@joysaha7424 2 жыл бұрын
Tnx broo......it’s worked...
@saniyasyed2638
@saniyasyed2638 3 жыл бұрын
At 12:58 static void decreasingpattern(int n){ for(int i=0;ii; j--){ System.out.print("*"); } System.out.println(); } } public static void main(String[] args) { System.out.println("Hello, World!"); decreasingpattern(6); }
@itgamer31
@itgamer31 3 жыл бұрын
thank you
@ashritk20
@ashritk20 4 жыл бұрын
Formula in Java Expression (n*9.0/5.0) + 32.0 Sir your Videos, practice sets and chapter notes are very helpful to students in clearing their concepts of Java.👍
@SoothingWaves4226
@SoothingWaves4226 Жыл бұрын
make it like 9.0f
@himankgupta325
@himankgupta325 2 жыл бұрын
sach btau to bilkul bhi man nhi krta practice set krne ka but jab practice set complete ho jata hai to bhaut kuch sikhne ko milta hai
@mohitdahal2257
@mohitdahal2257 4 жыл бұрын
Life was going great until the recursive method concept came in. It is like code doing time travel
@naveenkamboj9489
@naveenkamboj9489 3 жыл бұрын
Sahi bhai
@programming_praneet1779
@programming_praneet1779 3 жыл бұрын
😂😂 well , but harry teached it in a easy way, but yeah it was complicated
@yashjha2193
@yashjha2193 7 ай бұрын
@@programming_praneet1779 still complicated listening to this(recurssion) for 4th time
@harshdesai404
@harshdesai404 3 жыл бұрын
13:19 j's loop will work j0; i--){ for (int j=0; j
@someshlakhe563
@someshlakhe563 3 жыл бұрын
You can also use arr.length to devide the sum in problem 6
@sailajavankayala721
@sailajavankayala721 4 жыл бұрын
ek vdo banani mai bahut hard work lagti hain dosto like toh kuch bhi nhi hai uske samne ...har vdo mai like dil se aur yaad se kar diya karo ...itne mehnat aur consistency k liye toh ..appreciation banta h.....extremely hearty regards to sir ..
@cuberkam9072
@cuberkam9072 4 жыл бұрын
13:22 Second loop : for(int j = n; j> i ; j--) { //Code to print a star }
@HemantKumar-wy1hj
@HemantKumar-wy1hj 4 жыл бұрын
Y problem no 7 da solution v bta do
@amanbhobhria4418
@amanbhobhria4418 4 жыл бұрын
28:53 for conversion of celsius to faherenit static void Temperature(float c) { if (c ==0) { System.out.println("32 Faherenit "); } else { float f = (c * 9 / 5) + 32 ; System.out.println(f+" Faherenit"); } } public static void main(String[] args) { Temperature(45); }
@mr.arindamkhan
@mr.arindamkhan 3 жыл бұрын
Thank you sir
@AmaanKhan-mk5hf
@AmaanKhan-mk5hf 3 жыл бұрын
static void Temperature(float c) { float f = (c * 9 / 5) + 32 ; System.out.println(f+" Faherenit"); } Itne mai kaam hojaata
@XamsLyf
@XamsLyf 3 жыл бұрын
you can also do this public class main { static float Temperature(float c) { if (c ==0) { return 32; } else { float f; return f = (c*9 / 5) + 32; } } public static void main(String[] args) { float p = Temperature(45); System.out.println(p); } }
@shivamsrivastava7486
@shivamsrivastava7486 Жыл бұрын
Bhailog humlog static void use krte kbhi static int kab kya use krna h kaise smjhen??
@techpentagon1014
@techpentagon1014 Жыл бұрын
static void temperature(float f){ System. out.println(((f-32)/9)*5); } public static void main(String[] args){ temperature (56);
@ayushgupta_3017
@ayushgupta_3017 2 жыл бұрын
28:26 //Problem no 7 static void pattern2_rec(int n){ if(n>0){ for(int i=n;i>=1;i--){ System.out.print("* "); } System.out.println(); pattern2_rec(n-1); } }
@mrunknown855
@mrunknown855 Жыл бұрын
it creates pattern **** *** ** * not * ** *** ****
@mayureshlavangare116
@mayureshlavangare116 2 жыл бұрын
20:25 Problem 6: Find the average of set of nos passed as arguments using VarArgs: public class chap7_Practice_set { static int avg(int ...arr){ int result=0; for(int element:arr){ result = result+element; } return (result/arr.length); } public static void main(String[] args) { int c = avg(1,2,3,4,5,6,7); System.out.print("The avg of nos passed as arguments are "+c); } }
@deepanshusaini6242
@deepanshusaini6242 2 жыл бұрын
19:37 Find average of given number in method static float average(float...marks){ float total=0; for (float scan:marks){ total+=scan; } System.out.println(total/ marks.length); return total; } public static void main(String[] args) { float sum=average(1,2,3,4); }
@vedaprajnachakrabarti3472
@vedaprajnachakrabarti3472 2 жыл бұрын
what is the significance of writing sout before the return? i wrote return before sout and it didn't work but when i wrote first sout and then return it worked. please help
@a038fawaazahmed3
@a038fawaazahmed3 2 жыл бұрын
This code will print 2 answers 1 = sum of numbers and then print the average.For make it easy to understand just write total +=a/arr.length; under the for each loop.
@horn8028
@horn8028 Жыл бұрын
Question is to be solved by number passed as argument and you have solved it directly. Please if you could update the answer as per Qn. It will be very helpful. Thanks
@fascinatingtop1015
@fascinatingtop1015 5 ай бұрын
static float avg (float ...tpp){ float result = 0; for (float e:tpp){ result = result + e; } return result/tpp.length; } public static void main(String[] args) { float result = avg(4,5,6,7); System.out.println(result); }
@tusharnarang4334
@tusharnarang4334 4 жыл бұрын
Temp Conversion: static float conversionTemp(int n){ if(n==0){ return 32f; }else { return n*9/5+32f; } } public static void main(String[] args) { Scanner sc= new Scanner(System.in); System.out.println("Enter the Temp you want to convert"); int temp= sc.nextInt(); float res= conversionTemp(temp); System.out.println(res);
@ultrahindustanigamer8733
@ultrahindustanigamer8733 Жыл бұрын
Bhai tujhe f hatana hoga Varna yeh error throw karega
@iamnisk8260
@iamnisk8260 4 жыл бұрын
I remember when I had zero knowledge on java and willing to dive into this java course. so what I first did was, I searched for complete java course on KZbin in hindi. The first video i found there was yours . It was about 2-3 hours long. And then I got some basic idea where to get started and learned from different resources. Now even if i say i know java not much but i have some basic concept on it, i'm not actually very confident on what i've learnt for all this time. I'm really confused because learning from websites are actually hard . They are not providing tuttorials step by step but rather focusing on just completing the syllabus with no detail information. Today as i"m writing this, even if i say i'm not much confident on saying that i know java , What i'm really confident is, all those websites are missing things for beginners like us . As i was back to youtube where i started , i was researching for honest complete tutorial on java. Definitely there are some good channels like telusko , programming knowledge, but still there are things missing . and then i found this playlist , I'm planning to study from this playlist now but still i'm bit confuse here, i know these basic tutorial so it wont take me long to cover your playlist but what after completing these 35 videos ? As there's no upload time for your upcoming java videos , So i'm afraid wether to go through this playlist or not because what if i get more confused after the end of this playlist ? wether to wait for your new java videos or again go for new resources ? As i've seen some videos from this playlist, i'm really happy that you've gone in much more detail than any other youtuber but still , a small suggestion from your fan , brother . please reply with the upload time clarifying when to expect your new video for java . please _ with love
@joselitorebello6830
@joselitorebello6830 3 жыл бұрын
19:40 Question 6 solution : - static int avgN(int...num){ int elements = num.length; int sum = 0; for(int a: num){ sum +=a; } return sum/elements; }
@studywithsumanta
@studywithsumanta 3 жыл бұрын
thank you
@khushalchandak8544
@khushalchandak8544 3 жыл бұрын
Nice
@pankajgangwar7257
@pankajgangwar7257 3 жыл бұрын
pls explain pattern 2 using recursion
@khushalchandak8544
@khushalchandak8544 3 жыл бұрын
@@pankajgangwar7257 timelapse ke saath pucho ek baar
@pankajgangwar7257
@pankajgangwar7257 3 жыл бұрын
@@khushalchandak8544 thanks but ab ho gya run , it was just a silly mistake 😂
@bugsfounder
@bugsfounder 3 жыл бұрын
// QUESTION 6. static int average(float ...args){ float sum = 0; float average = 0; for (int i = 0; i < args.length; i++) { sum+=args[i]; } // System.out.println(sum); return (int) (average = sum/args.length); }
@lifeandliving2928
@lifeandliving2928 Жыл бұрын
bro i coded this public class Main{ static int Sum(int n){ int sum = n*(n+1)/2; return sum/n; } public static void main(String[]args){ int x = Sum(3); System.out.println(x); } }
@jatanyt1382
@jatanyt1382 4 жыл бұрын
This is very helpful course for beginners who are trying to learn java programming language. Thankyou so much
@saniyasyed2638
@saniyasyed2638 3 жыл бұрын
13: 40 --> for(int j=0; j
@pranav8883
@pranav8883 3 жыл бұрын
just use n-i
@wasim_17
@wasim_17 Жыл бұрын
13:30 for (int j=0; j < n - i; j++)
@SaurabhJeena-sh4gh
@SaurabhJeena-sh4gh 8 ай бұрын
Nhi sirf n hoga I solved it
@bluejprogramming184
@bluejprogramming184 6 ай бұрын
(Not mocking you or anything) Tumhare logic se: 1st iteration - 0 to n-1 (n times) 2nd iteration - 1 to n-2 (n-2) times.... mistake right at 2nd iteration
@anti-bug
@anti-bug 2 жыл бұрын
The answer of the questions that harry told us to solve 😍😍 // Question 5 => static int fibonacci_num(int index) { if(index==0 || index==1) { return index; } else { return fibonacci_num(index-1) + fibonacci_num(index-2); } } public static void main(String[] args) { /* Question 5: Write a function to print the nth term of the Fibonacci series using recursion. */ int i = 13; System.out.println("The " + i + "th term of fibonacci series is: " + fibonacci_num(i)); } } // Question 6 => float average(float ...arr) { float total = 0; for(float e: arr) { total += e; } float avg = total / arr.length; return avg; } public static void main(String[] args) { /* Question 6: Write a function to find the average of a set of numbers passed as arguments. */ Scanner sc = new Scanner(System.in); System.out.print("How many numbers you want to pass? : "); int a = sc.nextInt(); float [] arr = new float[a]; for(int i=0; i static void pattern_recur(int rows) { if(rows > 0) { for(int i=rows; i>0; i--) { System.out.print("*"); } System.out.println(); pattern_recur(rows-1); } } public static void main(String[] args) { /* Question 7: Repeat problem 4 using Recursion. */ int r = 4; pattern_recur(r); } // Question 9 static float fahrenheit(float cel) { float fahren = (cel * (9/5.0f)) + 32.0f; return fahren; } public static void main(String[] args) { /* Question 9: Write a function to convert Celsius temperature into Fahrenheit. */ float celcius = 15.7f; System.out.println(celcius + " °C" + " -> " + fahrenheit(celcius) + " °F"); } // Question 10 => static int nSum(int n) { int sum = 0; for(int i=1; i
@fayazmubarak7597
@fayazmubarak7597 2 жыл бұрын
@badalsahoo3902
@badalsahoo3902 2 жыл бұрын
Thank you bro for problem no 7 , my program's answer have same with your program but I did not see what is my mistake , then I see your code , and move pattern2_rec(n-1) logic to the line when the for loop is end! and it works , thanks😊💖
@yusrax3
@yusrax3 2 жыл бұрын
thnks for ques 7 i did same prog by putting loop in main method while calling function but after looking at ur code i found i could've directly put loop in func 👍🏻
@jdcreates7194
@jdcreates7194 Жыл бұрын
Thanks bro
@dayanandjajodia8698
@dayanandjajodia8698 Жыл бұрын
Thanks
@sharkieislive
@sharkieislive Жыл бұрын
Amazed how all it needed was moving 1 line public class Main { static void patt4_rec(int n) { if(n>0) { for(int i = 0;i
@Dxiag123
@Dxiag123 4 жыл бұрын
Great. Harry Bhai, you always make a smile on our face everytime. This revolution is going to be legendary.🙇🏻‍♂️🙇🏻‍♂️
@135_afshashaikh2
@135_afshashaikh2 2 жыл бұрын
13:40 static void pattern1 (int n) { for (int i = 0; i < n; i++) { for (int j = 0; j < n-i; j++) { System.out.print ("*"); } System.out.println (); } }
@harshkachhway4646
@harshkachhway4646 Жыл бұрын
29:01 [6/7, 10:13 PM] Harsh Kachhway: // q9. celsius to fahrenheit converion using function /method. /* static void conversion(double n){ System.out.print(n+"°c ="); System.out.print(((n*9/5)+32+"°F")); }*/ [6/7, 10:14 PM] Harsh Kachhway: in main function //conversion(5.5);
@kapilrana4043
@kapilrana4043 3 жыл бұрын
20:01 static int sum(int ...arr){ //Availiable as int [] arr; int result=0; for (int a:arr){ result +=a; } return result; } public static void main(String[] args) { float result=sum(3,5,6,7,8,9); System.out.println(result/6);
@blaze856
@blaze856 3 жыл бұрын
rather use arr.length so that you dont have to change the denominator foe average
@fascinatingtop1015
@fascinatingtop1015 5 ай бұрын
As a beginner, I created this Fibonacci, considering start as index as what I thought and had a look from wiki : public static int fib(int start1,int start2, int end) { int empty; if (end ==1 || end ==0) { return start1; } else { int sum = start1 + start2; return fib(start2, sum, end-1); } } public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("Enter the number whose term you'd like to see "); int end = sc.nextInt(); int start1 = 0; int start2 = 1; int result = fib (start1, start2, end); System.out.println(result); }
@RitikKumar-rf4dc
@RitikKumar-rf4dc 3 жыл бұрын
13:15 public class Main{ public static void pattern(int n){ for (int i=n;i>=0;i--){ for (int j=i;j>0;j--){ System.out.print("*"); } System.out.println(); } } public static void main(String[] args) { pattern(4); } }
@junaidjameel5049
@junaidjameel5049 3 жыл бұрын
Thanks Bhai
@sanketzanje2210
@sanketzanje2210 3 жыл бұрын
👍👍
@vaibhavbangadkar6426
@vaibhavbangadkar6426 3 жыл бұрын
@P U B G STARS int a i think
@vaibhavbangadkar6426
@vaibhavbangadkar6426 3 жыл бұрын
Bhai infinite stars ban gye
@vaibhavbangadkar6426
@vaibhavbangadkar6426 3 жыл бұрын
@P U B G STARS abhich run kiya
@Video_4U
@Video_4U Жыл бұрын
20:15 q no 6 static int average(float ...args){ float sum = 0; float avg = 0; for (int i = 0; i < args.length; i++) { sum+=args[i]; } // System.out.println(sum); return (int) (avg= sum/args.length); } public static void main(String[] args) { float c = average(55,45,54,56,65); System.out.println(c); }
@XamsLyf
@XamsLyf 3 жыл бұрын
20:20 Problem -7 solution public class Main { static void pattern2_rec(int n){ if (n>0){ for(int i=n; i>0; i--) // i=0 ; i
@nazarakhan2797
@nazarakhan2797 3 жыл бұрын
Thank you so much brother
@punnamsravan729
@punnamsravan729 3 жыл бұрын
Tq bro
@jayendrayadav3231
@jayendrayadav3231 3 жыл бұрын
thank u buddy
@shivpansara8469
@shivpansara8469 2 жыл бұрын
Q7 static void pattern2(int n) { if(n>0){ for (int i = 1; i
@shankarvishwakarma9400
@shankarvishwakarma9400 3 жыл бұрын
Isn't worry big brother Video lecture is amazing We'll are liking and supporting And at first big thankful , that u re providing best and free classes ❤️❤️
@Mr.AIAnukalp
@Mr.AIAnukalp Жыл бұрын
ye Isn't worry kya hota he?
@ShivamSingh-te9tl
@ShivamSingh-te9tl Жыл бұрын
@@Mr.AIAnukalp I think he want to say Don't worry!
@Mr.AIAnukalp
@Mr.AIAnukalp Жыл бұрын
@@ShivamSingh-te9tl bhai tum ab reply kar rhe ho 🤣🤣 btw happy coding😙😙
@ShivamSingh-te9tl
@ShivamSingh-te9tl Жыл бұрын
Arey wo comment kisi aur ka h bro! btw yaa Happy Coding : )
@sanvirathore39
@sanvirathore39 Жыл бұрын
29:19 public class newset{ static float conv(float n){ float temp=(n*1.8f)+32; return temp; } public static void main(String[] args) { System.out.println(conv(20f)); } }
@fardeenkhan4609
@fardeenkhan4609 4 жыл бұрын
28:50 static float DtoF(float d){ float mul = d * 9/5; float add = mul + 32f; return add; } public static void main(String[] args) { Scanner sc = new Scanner(System.in); float d = sc.nextFloat(); System.out.println(DtoF(d));
@rishimegharaj2913
@rishimegharaj2913 2 жыл бұрын
Bro float mul=d*(9/5f); Or your d gets multiplyed by 9 first by Associvity
@shafiullahamiri8900
@shafiullahamiri8900 2 жыл бұрын
sir as I am started watching your course, I am very happy and thankful from u sir . This is problem 4 in video No. 35 for (int j=4; j>i-0; j--){ System.out.print("*"); } this is the solution to print following **** *** ** *
@anshdholakia714
@anshdholakia714 4 жыл бұрын
Haris, I will give you money once I start to earn from freelancing because I have never gone to a coaching class and have only been taught from your videos. I will applaud your video once I receive some money
@ShiveshSumbly
@ShiveshSumbly 3 жыл бұрын
one more way of solving the pattern problem using recursion and without using any loops: static int i = 0 ; static int j = 0 ; static void star(int n ) { if(ii) { System.out.println(); i++; j=0; } star(n); } }
@shashaankkota9020
@shashaankkota9020 3 жыл бұрын
20:20 Problem 7 public class Prob7 { static void pattern4(int n){ if(n>0){ for(int i=n; i>0; i--){ System.out.print("*"); } System.out.println(); pattern4(n-1); } } public static void main(String[] args) { pattern4(4); } }
@fazal9013
@fazal9013 3 жыл бұрын
Thank u.I unable to understand where to call the function.
@bill-cipher000
@bill-cipher000 2 жыл бұрын
wow
@Vishnu4Vinita
@Vishnu4Vinita 2 жыл бұрын
Thanks bhai
@adarshkamji8643
@adarshkamji8643 4 жыл бұрын
6th Answer: public class Main{ static int avg(int...arr){ int sum = 0; int result=0; int n = arr.length; for(int i=0;i
@joselitorebello6830
@joselitorebello6830 3 жыл бұрын
20:18 Question 7 solution :- static void patRec2(int num){ if (num >0){ for (int i = 0; i
@Kanha0321
@Kanha0321 3 жыл бұрын
thank you so much
@harshraval3307
@harshraval3307 3 жыл бұрын
thank you so much
@shaileshhacker
@shaileshhacker 3 жыл бұрын
Ye to question 8 ka solution hai
@XamsLyf
@XamsLyf 3 жыл бұрын
Yes e 7 ka nhi hai
@bhavyajain_16
@bhavyajain_16 3 жыл бұрын
ans 6: static float varags(int...arr) { int sum = 0; for (int a:arr) { sum+=a; } float avr = sum/arr.length; return avr; } public static void main(String[] args) { System.out.print(" Ans 6: "); System.out.println("The average of a set of number is: "+varags(1,2,3)); }
@eaglehunter6487
@eaglehunter6487 3 жыл бұрын
Question 9 static double faharneit(double c){ return (c*9/5)+32; } public static void main(String[] args) { double a,c; Scanner sc = new Scanner(System.in); System.out.println("Enter temperature in celcius"); c=sc.nextDouble(); System.out.println("Faharneit temperature is: "+faharneit(c)); }
@copelofficial493
@copelofficial493 2 жыл бұрын
scanner utility is missing
@IshmeetSinghBaweja
@IshmeetSinghBaweja 2 жыл бұрын
Harri bhai mera logic building aapse strong hai 😀 Maine start priting wala program pahli baar me hi sahi likha, jabki aapse mistake hui, koi ni, chalta hai. 😀😀😀😀
@dnyaneshwarigund9616
@dnyaneshwarigund9616 2 жыл бұрын
19:37 public class QuestionSixAnswer { // Write a function to find average of a set of number passed as argument // Method Definition: static double Average (int ... a) { double sum = 0; for (int i:a) { sum += i; } return sum / a.length; } public static void main (String[] args) { // Write a function to find average of a set of number passed as argument // Method Call: System.out.println ("The average of 1,2,3,4 and 5 is: " +Average (1, 2, 3, 4, 5)); } }
@Jobajeki
@Jobajeki Жыл бұрын
Bro ispe 'a' ko call kaha pe kiaa 😮
@krishnasontakke7841
@krishnasontakke7841 4 жыл бұрын
13:38 for (int j =0; j
@hritikgupta2795
@hritikgupta2795 3 жыл бұрын
Q-2 by recursive method class javaProgram { static void pattern2(int n){ if(n>0){ for(int I=0;i
@abhitesh323
@abhitesh323 3 жыл бұрын
19:45 static int array(int... arr){ int sum= 0; int avg=0; for (int e:arr){ sum+=e; avg=(sum/(arr.length)); }return avg; } public static void main(String[] args) { System.out.println("avg of students is "+array(56,66,66,49,99));
@Sachinhooda44
@Sachinhooda44 6 ай бұрын
Avg ko float Lena tha bhai nahi to incorrect answer mil sakta hai Aur array and sum ko bhi float loge to float arguments bhi daal skte hai
@Time_Traveller
@Time_Traveller 2 жыл бұрын
13:14 //Question 4 static void pattern2(int x){ for(int i=0; ii; j--){ System.out.print("* "); } System.out.println(""); } } public static void main(String[] args) { // Question 4 pattern2(10); }
@iamakhil7705
@iamakhil7705 2 жыл бұрын
right bro
@tushardhomane1343
@tushardhomane1343 2 жыл бұрын
13 : 26 ---> void pattern2(int n){ System.out.println("pattern 2"); for(int i = n ; i > 0 ; i-- ){ // reverse loop for(int j = 0; j < i; j++){ System.out.print("*"); } System.out.println(); } }
@puckpuck18
@puckpuck18 4 жыл бұрын
// Question 6: static int sum (int... arr) { int result = 0; for (int e : arr) { result += e; } return result; } public static void main (String[]args){ int result = sum(55,453,576,553,52,67); System.out.println(result/6);
@shivanipaswan5657
@shivanipaswan5657 3 жыл бұрын
Sry to say but ye result+= e ka logic samjh ni aaya ap explain kr sakte ho plz🙏
@akhandbharat4855
@akhandbharat4855 3 жыл бұрын
@@shivanipaswan5657 varargs ke video mai explain kiye hai bhaiya ne
@rakhibarnwal4612
@rakhibarnwal4612 2 жыл бұрын
13:34 public class pr_04 { static void pattern(int n){ for(int i = 0;i
@priyanshuborole8228
@priyanshuborole8228 4 жыл бұрын
13:45 static void num(int n){ for (int i = 1;i=i;j--){ System.out.print("* "); } System.out.println(); } } public static void main(String[] args){ num(4); }
@kroorkartik
@kroorkartik 3 жыл бұрын
J>=i+1 hoga vro
@MayureshDagale-sg6op
@MayureshDagale-sg6op 14 күн бұрын
" Question number 8 " explanation is OP ❤❤❤ Also Harry Sir is OP
@pulkitgupta5550
@pulkitgupta5550 3 жыл бұрын
@13:30 Harry bhai iske do answers ho sakte hain 1. agar hmara pehla for loop increment mein hai toh inner loop n-i times chalega 2. agar hmara pehla for loop decrement mein hai toh inner loop i times chalega
@Clarara-is9li
@Clarara-is9li 9 ай бұрын
19:44 6th question public static void avg(int ...arr){ int sum=0; int res=0; for(int element:arr){ sum=sum+element; } res=sum/ arr.length; System.out.println(res); } public static void main(String[] args) { avg(99,98,97,96,99); }
@paragkaushik9595
@paragkaushik9595 3 жыл бұрын
13:44 //Problem 4 static void pattern2(int n){ for(int i=1; i
@karvapatel2998
@karvapatel2998 2 жыл бұрын
bro can you please explain this logic
@pratikshaparalikar3001
@pratikshaparalikar3001 Жыл бұрын
esne c++ kejaysa kiya hai
@infini7878
@infini7878 Жыл бұрын
@@pratikshaparalikar3001 j-- ayega
@sumanpan6667
@sumanpan6667 Жыл бұрын
thanks ❤
@meghaagarwal354
@meghaagarwal354 4 жыл бұрын
static void cel_fah(float c){ double result; result=(c*(9/5.0f))+32; System.out.println(result); } public static void main(String[] args){ cel_fah(52); Harry Bhai your tutorial is ReALLY awesome!
@harshithvellala2589
@harshithvellala2589 3 жыл бұрын
Program for question 6 static float avg(int...arr){ int sum = 0; for (int a:arr){ sum = sum +a; } float avg = sum/ arr.length; return avg; } public static void main(String[] args) { float avg = avg(1,5,10); System.out.println(avg); }
@anikajain7660
@anikajain7660 3 жыл бұрын
Thankyou
@vanshshrivastava5885
@vanshshrivastava5885 3 жыл бұрын
ty
@nandiniverma5273
@nandiniverma5273 3 жыл бұрын
thanks
@swapniludapure5926
@swapniludapure5926 3 жыл бұрын
Thanks ❤️
@dangergamimg1933
@dangergamimg1933 2 жыл бұрын
@@nandiniverma5273 . You look like sister of SoulRegaltos
@asifqureshi3273
@asifqureshi3273 3 жыл бұрын
Question-4 j < n-i
@sumitkaith6677
@sumitkaith6677 4 жыл бұрын
Recursion wale program smjh hi nhi aa rhe .... Uper se ja rhe h 😭😭
@yashsavaliya9334
@yashsavaliya9334 3 жыл бұрын
me too
@vidyasagarsharma5225
@vidyasagarsharma5225 Жыл бұрын
Same bro
@kalpanamadane8186
@kalpanamadane8186 Жыл бұрын
Same here
@GAMINGWORLD-rg9uj
@GAMINGWORLD-rg9uj Жыл бұрын
Same
@shivvratraghuvanshi522
@shivvratraghuvanshi522 Жыл бұрын
@@GAMINGWORLD-rg9uj same🥲
@abhitesh323
@abhitesh323 3 жыл бұрын
13:00 static void pattern(int n){ for (int i=n;i>0;i--){ for (int j=0;j
@palakdhewal4581
@palakdhewal4581 3 жыл бұрын
19:41 @CodeWithHarry Answer to problem average static double average(int a[], int n) { // Find sum of array element int sum = 0; for (int i = 0; i < n; i++) sum += a[i]; return (double) sum / n; } public static void main (String[]args){ int arr[] = {10, 2, 3, 4, 5, 6}; int n = arr.length; System.out.println(average(arr, n)); } }
@ashoktiwari7705
@ashoktiwari7705 2 ай бұрын
10 question's answer is==> static void repeat(int n){ int mt=1; for (int i=1;i
@Prakashkumar-if8sk
@Prakashkumar-if8sk 3 жыл бұрын
28:32 static float temp (float n){ float a = n*1.8f + 32; return a; } public static void main (String [] args) { float x = temp(37); Sout(x) }
@Time_Traveller
@Time_Traveller 2 жыл бұрын
//Question 9 // (0°C × 9/5) + 32 = 32°F static float ftemp(float x){ float temp =0.0f; temp = (x*1.8f) + 32; return temp; } public static void main(String[] args) { System.out.println(ftemp(29.5f)); }
@SauravDeopaVlogs
@SauravDeopaVlogs 3 жыл бұрын
Thnq harry bhai recursion wali problem start m smjh nhi ayi but jab apki video multiple times dekhe smjh agya thnq for such great efforts❤
@carzydance162
@carzydance162 3 жыл бұрын
Problem 4: static void pattern2(int n){ for (int i=n; i>0; i--){ for (int j=1; j
@Banian.reactz
@Banian.reactz Жыл бұрын
Thanks bhai
@PratikSingh-q8d
@PratikSingh-q8d Ай бұрын
13:40 the star iteration will be from o to
@mohulchakraborty3482
@mohulchakraborty3482 3 жыл бұрын
6)static int average(int...array){ int a = 0; for (int i = 0; i < array.length; i++){ a = a + array[i]; } return a/3; } public static void main(String[] args) { System.out.println(average(2,4)); } }
@tusharnarang4334
@tusharnarang4334 4 жыл бұрын
Pattern2 using Recursion:- if(n>0){ for (int i=n-1;i>=0;i--){ System.out.print("*"+ " "); } System.out.println(); pattern2_rec(n-1); }
@hxrsh_x
@hxrsh_x 2 жыл бұрын
bhai app bhagwan ho, dhanyawad aapka
@pulkit8133
@pulkit8133 4 ай бұрын
// problem 6 static int sum(int ...arr){ int summ=0; for(int e:arr){ summ+=e; } return summ; }
@chetananijaguli3145
@chetananijaguli3145 2 жыл бұрын
20:05 Find average of a set of numbers:- public class Varagrs { static float avg(float...arr) { float sum=0; float avg=0; for(float e:arr) { sum+=e; } avg=sum/arr.length ; return avg; } public static void main(String[] args) { System.out.println(avg(100,120,30)); System.out.println(avg(2,3,4)); } }
@deep1504
@deep1504 2 жыл бұрын
Q @4:48 public static void main(String[] args) { Scanner input = new Scanner(System.in); pattern(4); } public static void pattern(int n){ for (int i =0;i
@naveenkumarbalne9957
@naveenkumarbalne9957 2 жыл бұрын
reverse star Pattern using Recursion static void star1(int n) { if (n > 0) { for (int i = n; 0 < i; i--) { System.out.print("* "); } System.out.println(" "); star1(n - 1); } } public static void main(String[] args) { star1(6); }
@theandroidtech01
@theandroidtech01 2 жыл бұрын
Wrong
@badalsahoo3902
@badalsahoo3902 Жыл бұрын
Thanks bro ! 🎉, i understand , so i move the n-1 line after the call reserv .🆗
@KapilKumar-gf8eb
@KapilKumar-gf8eb 2 жыл бұрын
static void pattern2(int n){ for (int a = 0; aa+1; b--){ System.out.print("*"); } System.out.println(); } } public static void main(String[] args) { pattern2(4); }
@aftabmuddassir4435
@aftabmuddassir4435 3 жыл бұрын
static float avg(int ...arr){ float sum=0, average; for(int i=0;i
@harshit0203
@harshit0203 2 жыл бұрын
Did Question 3 with different approach:- static int sum(int n){ int sum = 0; for ( int i=0; i
@mohdsharif738
@mohdsharif738 4 жыл бұрын
Thanks you very much Please explain recursion in a separate video please
@pulkit8133
@pulkit8133 4 ай бұрын
// Problem 8 static void P2(int x){ if(x>0){ for(int i=0;i
@GrowwithVivek08
@GrowwithVivek08 4 жыл бұрын
I know the expression for conversion of Celsius to fahreneit C/💯=F-32/180 ..
@AmaanKhan-nb4nr
@AmaanKhan-nb4nr 2 жыл бұрын
public class Main { static void printt(int n){ for(; n>=1; n--){ for(int j =1; j
@shivamchauhan1383
@shivamchauhan1383 2 жыл бұрын
13: 30 public class S_CH7_04 { static void pattern2(int n){ for(int i=n;i>=1;i--){ for(int j=1;j
@lamborghini543
@lamborghini543 Жыл бұрын
Happy Teacher's Day "Harry Sir" .🎉🎉
@dnyaneshwarigund9616
@dnyaneshwarigund9616 2 жыл бұрын
29:25 // Write iterative function/Method to calculate sum of first n natural number import java.util.Scanner; public class QuestionTenthAnswer { static int SumNaturalNumIterative (int n) { int sum = 0; for (int i = 0; i
@patelparth3873
@patelparth3873 4 жыл бұрын
Sir, Your method of teaching with practical examples are best for learning .....it helps us very much ........... Lekin sir please aap thoda jaldi videos banao......because next video aane me jyada time lagta hai to previous video ke sath link Karne me taklif hoti hai..... Aur videos ke bich me gap pade to maja nahi aata...... So please aap Hamare liye continuously puri playlist complete kare esi request hai .....videos jaldi aa jate hai to sikhne ki link 🔗 🔗 bani raheti hai aur sikhne me aasani hoti hai....... Thank you 🤗
@dakshgarg775
@dakshgarg775 4 жыл бұрын
12:58 solution is static void pattern2(int rows){ for(int i=rows;i>=1;i--){ for(int j=i;j>=1; j--){ System.out.print("*"); } System.out.println(); } }
@avadhutpore6884
@avadhutpore6884 3 жыл бұрын
Problem 4. For ( int i =0 ; i
@oneforcegamerx
@oneforcegamerx 4 жыл бұрын
This java course is helpful.
@teerthpathak4273
@teerthpathak4273 2 жыл бұрын
13:20 static void pattern2(int n){ for (int i = 0; i < n; i++) { for (int j = n; j > i; j--) { System.out.print("*"); } System.out.println(); } }
@nitinjagga2841
@nitinjagga2841 4 жыл бұрын
Solution To Problem 6- 19:50 static int average_finder(int ...arr){ int sum = 0; for (int num: arr) { sum = sum + num; } return sum/arr.length; } int result = average_finder(5, 4, 9); System.out.println(result);
@alekhbhainsa4690
@alekhbhainsa4690 4 жыл бұрын
Please replace int with float....as average is an floating num.
@natikadas700
@natikadas700 4 жыл бұрын
28:47 static float CtoF(float n){ return ((n * 9/5) + 32); } Method to convert °C to °F
@dildosti7769
@dildosti7769 3 жыл бұрын
thanks
@hemantsharma7335
@hemantsharma7335 5 ай бұрын
static void avg(int ...arr){ int c=arr.length; int sum=0; for(int e:arr){ sum += e; } float avg=sum/c; System.out.println("avrage is : "+avg+"%"); }
@somnath__mondal
@somnath__mondal 3 жыл бұрын
I can not code Question 4 using Recursion ! Please help me !
@tushardhomane1343
@tushardhomane1343 2 жыл бұрын
21:15 public class VarArgs { int max; int average(int... arr){ for (int i = 0;i
Java Tutorial: Introduction to Object Oriented Programming
15:13
CodeWithHarry
Рет қаралды 880 М.
Java Tutorial: Variable Arguments (VarArgs) in Java
12:52
CodeWithHarry
Рет қаралды 464 М.
Quando A Diferença De Altura É Muito Grande 😲😂
00:12
Mari Maria
Рет қаралды 45 МЛН
Beat Ronaldo, Win $1,000,000
22:45
MrBeast
Рет қаралды 158 МЛН
VIP ACCESS
00:47
Natan por Aí
Рет қаралды 30 МЛН
Арыстанның айқасы, Тәуіржанның шайқасы!
25:51
QosLike / ҚосЛайк / Косылайық
Рет қаралды 700 М.
Web Developer Roadmap (2025) - Everything is Changing
21:48
CodeWithHarry
Рет қаралды 130 М.
Java Tutorial: Method Overloading in Java
24:00
CodeWithHarry
Рет қаралды 727 М.
Java tutorial: Practice Questions on Loops
25:49
CodeWithHarry
Рет қаралды 569 М.
Java Tutorial: Access modifiers, getters & setters in Java
12:56
CodeWithHarry
Рет қаралды 661 М.
5 Simple Steps for Solving Any Recursive Problem
21:03
Reducible
Рет қаралды 1,3 МЛН
Learn Coding & Get a Job (in 2025) 🔥
16:54
CodeWithHarry
Рет қаралды 760 М.
Java Tutorial: Methods in Java
21:36
CodeWithHarry
Рет қаралды 999 М.
Quando A Diferença De Altura É Muito Grande 😲😂
00:12
Mari Maria
Рет қаралды 45 МЛН