Loops in One Shot | C Programming | Lecture 3 | Complete C Course
Вставка
- Опубліковано 28 лип 2024
- In this video, Raghav Sir will teach you LOOPS in DETAIL. This is Lecture 3 of the C Programming series. Topics covered are - For Loop, While Loop, Do While Loop and LOTS of QUESTIONS. Pattern Printing will be covered in the next Lecture in detail, coming SOON.
Notes of this lecture - drive.google.com/drive/folder...
If you are joining us late, to know more about PWSkills & plans :
Watch the Orientation Video: • C++ DSA and Java DSA -...
Watch the Launch Video: • @CollegeWallahbyPW THI...
▶️ PW Skills Website - pwskills.com
▶️ PW Skills Instagram - / pwcollegewallah
▶️ PW Skills LinkedIn Channel -
▶️ PW Skills Telegram Channel- t.me/SkillsPW
Timestamps :
00:00 Introduction
01:35 What and Why
05:53 FOR LOOP
09:50 How For Loop works
30:15 Problem 1 : Print all numbers from 1 to 100
34:56 Problem 2 : Print all even numbers from 1 to 100
37:36 Homework 1 : Print all odd numbers from 1 to 100
37:50 Problem 3 : Print the table of 19
40:07 Homework 2 : Print the table of ‘n’. Take ‘n’ input from user
40:42 Problem 4 : Print the AP - 1,3,5,7,9.. upto ‘n’ terms
47:13 Problem 5 : Print the AP - 4,7,10,13.. upto ‘n’ terms
50:34 **Printing AP WITHOUT using MATHEMATICAL FORMULA
58:28 Problem 6 : Print the GP - 1,2,4,8,16.. upto ‘n’ terms
1:00:55 Homework 3 : Print the GP - 3,12,48.. upto ‘n’ terms
1:01:16 **Problem 7 : Print the AP - 100,97,94.. upto all terms which are positive
1:10:48 Homework 4 : Print the GP - 100,50,25.. upto ‘n’ terms
1:12:42 BREAK statement
1:13:07 Problem 8 : Program to find out if given number is prime or not
1:38:16 CONTINUE statement
1:38:28 Problem 9 : Print all odd numbers from 1 to 100 using CONTINUE
1:43:41 Homework 5 : Print all even numbers from 1 to 100 using CONTINUE
1:44:15 WHILE LOOP
1:49:47 INFINITE LOOP
1:53:11 Problem 10 : Predict the output 1
1:56:34 Problem 11 : Predict the output 2
1:57:33 Problem 12 : Predict the output 3
1:58:58 Problem 13 : Predict the output 4
1:59:34 Post / Pre - Increment / Decrement operators
2:05:03 Problem 14 : Predict the output 5
2:07:31 Problem 15 : Predict the output 6
2:10:38 Problem 16 : Predict the output 7
2:12:44 Problem 17 : Predict the output 8
2:13:56 Problem 18 : Predict the output 9
2:15:55 Homework 6 : Predict the output 10
2:16:29 DO WHILE LOOP
2:21:25 Questions using Operators
2:21:53 Problem 19 : Program to count digits of a given number
2:31:20 Problem 20 : Program to print sum of digits of a given number
2:39:26 Homework 7 : Program to print sum of even digits of a given number
2:40:22 Problem 21 : Program to print reverse of a given number
2:53:27 Homework 8 : Program to print sum of given number and its reverse
2:54:04 Problem 22 : Print sum of series - 1+2-3+4-5+6.. upto ‘n’ terms
3:07:40 Problem 23 : Print the factorial of given number
3:16:09 Homework 9 : Print the factorials of first ‘n’ numbers
3:21:43 Problem 25 : Print the nth fibonacci number
3:38:36 Homework 10 : Print the first ‘n’ fibonacci numbers
3:39:39 Problem 26 : Given 2 numbers ‘a’ and ‘b’ , find ‘a’ raised to the power ‘b’.
3:48:09 Problem 27 : Print all alphabet and their corresponding ASCII values
3:55:31 Homework 11 : Print all armstrong numbers between 1 and 500
#CProgramming #CollegeWallah #PhysicsWallah #Loops #Loopsinoneshot
📗 Enroll Now in Decode Batches and become JOB READY:
📌 Python with DSA: bit.ly/4bXv5xF
📌 Java with DSA: bit.ly/49vEQkZ
📌 C++ with DSA: bit.ly/49NnNKT
The amount of happiness you get after a code finally runs🙂
😂😂😂 yeahh fr
Excellent 👌
Well done
fr💀
Is infinite 😊
who are from semester 1 student?
✋
🙋
Me....
class 10😮
Bhai 10th me focus kr
40:42 Problem 4 : Print the AP - 1,3,5,7,9.. upto ‘n’ terms
50:34 **Printing AP WITHOUT using MATHEMATICAL FORMULA
1:01:16 **Problem 7 : Print the AP - 100,97,94.. upto all terms which are positive
1:13:07 Problem 8 : Program to find out if given number is prime or not
1:33:10
1:38:28 Problem 9 : Print all odd numbers from 1 to 100 using CONTINUE
1:49:47 INFINITE LOOP
2:03:50
2:12:44 Problem 17 : Predict the output 8
2:13:56 Problem 18 : Predict the output 9
2:21:53 Problem 19 : Program to count digits of a given number
2:31:20 Problem 20 : Program to print sum of digits of a given number
2:39:26 Homework 7 : Program to print sum of even digits of a given number
2:40:22 Problem 21 : Program to print reverse of a given number
2:53:27 Homework 8 : Program to print sum of given number and its reverse
2:54:04 Problem 22 : Print sum of series - 1+2-3+4-5+6.. upto ‘n’ terms
3:07:40 Problem 23 : Print the factorial of given number
3:16:09 Homework 9 : Print the factorials of first ‘n’ numbers
3:21:43 Problem 25 : Print the nth fibonacci number
3:38:36 Homework 10 : Print the first ‘n’ fibonacci numbers
3:39:39 Problem 26 : Given 2 numbers ‘a’ and ‘b’ , find ‘a’ raised to the power ‘b’.
3:48:09 Problem 27 : Print all alphabet and their corresponding ASCII values
3:55:31 Homework 11 : Print all armstrong numbers between 1 and 500
Itni mehnat kyu krta ho jab already commented hi toh😊
Gajab bru
Sir Excellent 👌 teaching 😊
kisi ne homework solve kiya hai? please kese hoga print table of n . aur odd number wala .
Comment out krde Bhai apna comment😂😂
at 1:57:21 there was a semi colon just after the condition of while statement while(i
Yes you got that right even I was thinking the same.
Same here
Yes , you got it
I am thinking also
53:00 can someone explain the without using maths method?
Nhi samajh aaya
yes you are right
Sir Jaldi Jaldi Video Laiye Aap C Language me itna interest Bana diye hai ki wait nhi ho raha and Exam bhi hai Jan me sir So please Complete This series as soon as possible...❤️✨
@@RohitSingh-jg3sw learn python,,
It's very easy language,,
Easily samaj aa jayegi 😊,,
&
Then DSA bhi python me kar sakte ho,,
Python & javascript is most popular language now
@@jayw698 but he's saying that he's in 1st year.....So what will he do in exam....Maybe C Language is 1st year syllabus
@@samislost550 exam ke liye pyqs dekho ,,,
Jitni c language important hai utna karke nipta do,,
C is important just for college exam,,
You should not give much importance to college exam,, college ka syllabus prepare karne se placement nahi hoga
One more suggestion-
C language me tumhe coding continue nahi karni chahiye,,, iske baad c++ pe switch kar jao
Reason - c++ is object oriented programming & c++ has STL library which will make data structures easy
C & c++ are 80% same hai,, so switching from c to c++ is easy,,,
Yeah one more thing c language me dikkat ho rahi hai to python kar sakte ho ,,
@@jayw698 Thank You So Much For Suggestions ❤️.....Gonna do it right now
Starting to learn C++ but continuing C also.......Waise bhi sir 10 din me upload karte hai c ka to cover ho jayega.....
@@samislost550 👍
worth it lecture to watch for freshers and even for those who just want to clear their basics !!
Thank u sir...❤❤❤❤❤❤
solution of hw at 2:53:00 is
int n;
printf("enter the number ");
scanf("%d",&n);
int a=n;
int r=0;
int x;
while(n!=0){
x=n%10;
r=r*10;
r=r+x;
n=n/10;
}
printf("the reverse of number is %d
",r);
printf("the sum of both is %d",r+a);
Thanks for giving answer .
Thanks for solution
Sir jaldi jaldi c language pura complete kara dijiye mid sem exam coming soon🥰❤️
If you have a good mentor who can teach you in the most appropriate way then everything looks to much easy..❤
bhai 2:21:25 m sir ne ki bola manvi mam ne ek lecture karwaya hai operators ke upar.........bhai vo video ka link de sakte ho bhai merko mil nahi raha hai video vo wala
@@shubhamkumar3139Bhai i think sir janvi mam ki Java playlist ki baat kar rahe Hain..wait Karo main link send karta hoon😇
I am student of IITJ and i have seen your video ,you provide very good content to the students to buid their career
thanks for providing good code.
happy coding!!
nice to meet you i am from IIT BHU
I am from home
After taking 2 years of gap
nice to meet you I am from IIT K
I am from vit Vellore
From VNIT Nagpur, are you people allowed a reference book in exam as here our clg is taking this subject very seriously they make such a paper that they even allow us to carry a book in the exam hall, I am just wondering what's happening in IIT
Watched the whole lecture 🎉🎉🎉🎉 Long but up to point ❤❤
such a masterpiece this lecture was! sir you made each and every concept seem so easy.
Bhot bhot dhanyawad sir jii ❤️🥰👍
We can never forget the role of teachers like youuu in building our career....
Sir ka name kya hai
@@addictgamer-bn8jl raghav
You have proved that pw's lectures are best 😊.
Completely dependent on you for C programming. THANK YOU SIR.
We want Lecture 4 Sir...Maza Aa Gaya Sir is lecture me🙌❤️
Thankyou ❤️ so much sir for this lecture bcz before this lecture i have many common doubt in loop but I watch this lecture all my doubt clear 😊😊
Alhumdulilah complete 😍😍
Thank you so much sir for this amazing lecture.🙂 This lecture is very helpful for students.
what a amazing lecture sir falling in love with coding now😍
Sir please continue this series. your teaching style is outstanding.
Sir i have enjoyed this lacture and this is the best c language tutorial in UA-cam thanks for making this amazing c language lacture for us and at last i would definitely say maza aagya
Sir mst explanation very very thanks 🙏🙏🙏 kaise khu etna acha content ko dekh ke
Really it is very nice to learn coding with you sir❤❤
This is a very informative lecture.
Thank you sir!
The amount of happiness you get after a code finally runs🙂okay
1:11:53 for those having error in this problem👇🏻
Make sure you have use printf(a=a*(1.0/2));
The issue is due to integer division. In C, when you divide two integers, the result is also an integer, and any fractional part is truncated. So (1 / 2) results in 0 rather than 0.5. Consequently, a remains unchanged since it's multiplied by 0, resulting in an infinite loop of printing 100.
(Taught in Lecture 1 i guess🤔)
Majaa aa gya sir, pura lecture smjh aa gya. Thank you very much!!
2:53:30 store value of n in any other variable ,for example a.
int a=n;
🙏
Thanks
Thanks bhai 🙂
Can you give us solution?
@@aryangupta6660 int n;
printf("enter the number ");
scanf("%d",&n);
int a=n;
int r=0;
int x;
while(n!=0){
x=n%10;
r=r*10;
r=r+x;
n=n/10;
}
printf("the reverse of number is %d
",r);
printf("the sum of both is %d",r+a);
I Have No Words Sir For Describe Youu!!❤️💯You Are The Bestt!✌️💥
I watched many videos on UA-cam, but no one explained every topic so well, sir, you explained it very well, thank you very much. ❤❤
Sir PW is the best
Waiting for lecture -4👍👍
Maza aa gaya sir... And you don't need to improve yourself sir... You are really a very good teacher... Loop pura acche se samjha diya apne
2024 batch attendance here....❤
I have watched the whole video...Thank you so much sir....🙏
Thankyou sir for giving this amazing lecture 😍😍
Thank you sir for your efforts 💗
sir Your teaching skills is really incredable ,,, mujhe c program se dar lagta tha logic samaj main nahi ata tha then upka ye video mera sara problem solve kar diye loop ka thank you sir
Although I am learning Java from Manvi Ma'am...But this series is really very helpful for revision of concepts and practice of questions...Thank you so much sir for this series...
Amazing sir, thanks 👍
Amazing lecture guruji🙏🙏
Sir is teaching very best, proper problem solving sum so you can practice a lot.
Semester 2 ✊
This is amazing tutorial video 👏👏👏
Best teacher for coding I have ever seen ♥️
Thanks sirrr bhut sare doubts clear hua aapke pdane se👌👌
sir i couldnt able to solve the homework at 2:53:30 . pls help me. ive already trying since 3 hours
You are so intelligent and good teacher sir 😊
Thanku so much 🙏
Maza aa Gaya Sir ❤ Thank you for the amazing lecture
Sir you are all-rounder !😊
You can teach anything whether it's the maths or any other programming language!!
Really helpful!!
@gurukripakevalam195 Yeah! obviously!!👍
Thank you so much Sir for this amazing Lecture 💓
You understand the feelings of the student. Thank you so much sir 💖💖💯💯
1:56:48 sir in this question there is semi colon in the end of line of while so the while loop will not run .
Then there will be no output
While loop is run infinite times
@nishantsingh3216 as there is a semi colon at the end of the while loop for that it will not run . U can check it in ur compiler.❤
@@sumontagarai9228 it will run and it will run infinite times but nothing print.
Yaa bro i have now seen it thanks for your cooperation.❤️
@@sumontagarai9228 I write that code in upper comment if u write printf("%d ", i) in between while(I
Thankyou sir for this amazing lecture.
MAZA AA GAYA
1:57:06 No output as while is already terminated in the first line.
1:56:52 Yaha par while loop infinite mode me chala jayega just because of that semicolon (;) .... Infinite mode me islie jayega kyuki i ki value hamesha 1 hi rhegi aur condition ko baar baar satisfy karega i.e. 1 is always less than 10.
Great observation
sir...Good work
keep Doing
in our society need teacher like you....
sir mai aapke video starting se dekh raha hu or muje pahle c language nahi aati thi but aapke video starting se dekhney ke baad aab muje c language learn karney mai or usse question solve karney mai bahut acha lag raha hai thank you so much sir 😁😄😇♥♥
Lightning lecture sir❤️🔥⚡
But sir in wap to reverse a given number 2:49:00
*If i want to reverse 120 it gives 21..and not 021*
Other non zero digit are going good
Complete dekhliya Maza aa gya Sir. Thank you Sir
2:53:10 sir for this que i have made a different code ->
while(n!=0){
lastDigit=n%10;
printf("%d",lastDigit);
n=n/10;
} this is working properly!!
sir whole lecture is great but please make a separate lecture for switch, go to etc... miscellaneous which is important for exam point of view..
As a first year i feel that this is best and detail video on loop in the youtube and question are also good
maza aaya padh ke 😃
par beta ye padh ke exam mai marks nahi ayenge marks
@@SumitsinhChauhan-xi3dk kyu?
@@SumitsinhChauhan-xi3dk??
1:57:25 the while loop does not work because of ; int the code so the statement will execute only one time
Execute hi nhi hoga there will be no output
thank you so much sir for excellent explanation...thnx
Sir your language is very simple we want more videos asap 😄😄😄😄
I'm just dealing with this subject becoz of your content and the way of teaching is commendable sir .
"Aap same us feel ke satb samjhate h jis tarah hum first time kisi language ko padhte wakt feel karte hain, ek alag he world lagta h pehel baar ye sab dekh or padh kar
😂sachhi me
thank u so much sir to make my coding journey easier
1:57:31....Here we would not get any output at all because there's a semicolon after while, so the code inside curly braces{} would not be executed by the compiler
Hello sir, i have a doubt. in fibbonacci series, why don't we print the value of a instead of sum
by doing so we would not have to change n to n-2 in loop and also there wont be any need to to change value of sum from 0 to 1.
int n;
printf("Enter a number : ");
scanf("%d",&n);
int a=1;
int b=1;
int sum = 0;
for (int i=1; i
Sir please just like our comments
When we see you will check our comments 🥰
sir maza aa gya, please bring lec4 asap and thank you so much
Sir in 2nd question
predict the output for while loop..
Int I=1;
While(I
Hamlog jaisa kamjor students ke liye aap jaise teacher hi ek ummid ka Kiran hote h sir
Thank you so much sir ❤❤
2:15:52 The output is- 3 1, 1 3, 0 4, -1 5 not only 3 1
because of garbage value of z i guess
sir forgot to repeat the loop
Yes loop will repeat again
yes loop will repeat again
hw question output is-40, 31, 22, 13, 04
Sir we need a teacher like you 😀
Kha sa ji
ITS REALLY HELPFUL SIR, THANKS A LOT SIR;
Thank you sir. this lecture took a lot of time to complete. As I am currently in my comfort zone at home. I took 5 days to complete this one lecture. But I will study more from now.
thank you sir best explaination
I am waiting .. For new lecture... 🤗🤗
completely enjoyful lecture ❤
For this Problem 1:07:41 we can get the same output with this code and we dont even have to make another variable but is this a good approach?
for (int i = 100; i > 0; i -= 3)
{
printf("%d ", i);
}
return 0;
Generalized Code For Printing Reverse Of A Number :
lastdigit = number % 10 ;
reverse = (reverse *10) + lastdigit ;
n= n/10 ;
In this code we do not print reverse of 2000 we get 2 as answer or any number which last with zero will not work in this code. Write code for every number not for specific number.
Sir at 1:57:21 while is having semicolon over there...then it will terminate the line??...then how output is coming???
Right i also think it's terminate
Problem number 8 To check number is prime or not
Wala solution ma thoda sa error hai
Agar hum 15,45 print karta hai to output ma prime number aa ta hai
Yah video bahut achha laga sir . Aur achhe se samajh me bhi aaya mujhe
Who are now second semester? ❤and understand this lecture very easy way 💚
Kon-2 h jisko class teacher ka bilkul bhi samaz nhi aata😅
😂
Me
Sir in 1:57:15 it will be an infinite loop, as there's a semicolon after while.
Bhai Mera to koe output hi nahi de raha hai😂😂
Great lecture sir!! Bohot Maja aya.
Sir please continue this C language series
2:53:47 anyone give the code
Thank you sir
You are amazing teacher
Sir aap aisa he video bnaye rheya hmara jaisa students ke leya ye bhut important hai
Thank you sir 🙇🙇
Really a greate and very helpful tutorial🙏🙏🙏🙏❤️❤️
Who is doing this in second year 😂😂
Is this needed in 2Year i m in 2 sem of 1 year and preparing it for exam so tell me if it imp then i should take it seriously
😢😅
You😂😂😅
Sir pura complete kab tak ho jayega C language please sir bta dijiye
Sir at 2:40:22 i did this problem by different method
int store;
int lastdigit;
while(n!=0){
lastdigit=n%10;
store= lastdigit;
n=n/10;
printf("%d",store);
}
Plz tell is this correct or not
Sir The question at 1:57:27
The code will not be able to run cause
after while(.....)there is a unexpected expression ' ; '
without ' ; 'it will print 1 to 10
Who are from 2nd semester students
Me hu
Me
@@Nikhil-kg5fv you're in primary school 🎒😂😂