#12: while Loop in C Programming | C Programming for Beginners
Vložit
- čas přidán 22. 07. 2024
- In this video, we will learn about while loop in C Programming. Here, we will learn to use a while loop to repeat a block of code multiple times and then create a multiplication table.
This video is a part of our C Programming video series: • #1: Getting Started wi...
Resources:
C Online Compiler: www.programiz.com/c-programmi...
Github File: github.com/programiz/c-youtub...
C while Loop Tutorials (text-based): www.programiz.com/c-programmi...
Timestamps:
00:00 - Start
00:31 - while Loop
05:01 - Create Multiplication Table
08:59 - do...while Loop
10:51 - while Vs. do...while Loop
11:53 - Programming Task
12:25 - Quiz
Revise your learning using our C App
Download here for Android: bit.ly/3upaInx
Download here for iOS: apple.co/3EZLtNq
Find Programiz elsewhere:
Website: www.programiz.com
Facebook: / programiz
Instagram: / _programiz
LinkedIn: / programiz
Twitter: / programiz
#whileloop #cprogramming #learnc #dowhile #loop
🔥Finding it Damn Hard to Understand C Programming?
Learn to code-the right way-with interactive lessons, quizzes & challenges. Build a strong programming base; it's IMPORTANT!
Try Programiz PRO for Free: bit.ly/master-c-programming
I was reading a programming book without understanding much, but the way she explains it is amazingly simple and easy, thank you very much, you saved my learning, now I'm more interested in programming
// Online C compiler to run C program online
//The program that can display a multiplication table with decrement value using while loop.
#include
int main() {
int number;
printf("Enter the number: ");
scanf("%d", &number);
int count=10;
while (count >= 1)
{
int product = count * number;
printf("%d x %d = %d
", number, count, product);
count = count-1;
}
return 0;
}
int main() {
int number;
printf("Enter the Number: ");
scanf("%d", &number);
int count = 10;
while (count >= 1){
int product = number * count;
printf("%d*%d =%d
",number,count,product);
count -= 1;
}
return 0;
}
I can watch these videos all day
The way she explains all these ao sweetly and everything is short and 1precise thank you for this beautiful playlist👍
Keep your focus on code 😊
who is here in 2024
Before studying my lectures notes, I must watch these tutorials because they make my studies easy ......thanks programiz
Your way of teaching is so beautiful. Thank you so much!
As always great crystal clear explanation! Thank you very much for everyone who are making this happen.
the best c tutorial in youtube , thanks a lot Padma 😍🙏👌
For quiz.....
To terminate the loop condition should be false and in this code value is always true hence all of these options are i finite loops...
So the answer is option D
look you've improved me so much!!!!! i really love your channel and i just wanna say God bless you deeply!!
this was a harder concept to teach but you did an excellent job
Hello ma'am,
I have a question!!!
Can while loop be used to count and display the frequency of each character in a string in the form of descending order??
Thank you, you guys made c more fun and easy to understand!
Thank God for your channel and videos 💪🏽🔥🔥❤
that cool🙏🙏 i was looking for programming help and i found your 🙌👉lec too high keep the fire burning 💥💥💥💥💥🙌🙌🙌
Thank you so much ma'am
This is really very helpful to me 🥰🥰🥰🥰🥰
And your accent is so understable 🙏🙏🥰🥰
Please ma'am keep doing this
I'm also using that app 😊
That was a great work done. I really enjoyed the lesson. The explanations and introductions are 100% but please the terms such as printf and scanf need some highlights for the beginners.
May i know what's the difference between for loop and while loop
Where well explained keep uploading more lecture 🎉🎉
I declared the product variable outside the while loop but after I tried printing it is not responding as it should please why?
Ma'am I have a question.
in the programiz quiz part the 3 option is missing the ';' but still the answer is all of the above. How?
I'm sooooo thankful for u!!!!
Thank you so much!!
I'm looking forward to your next video.
Q. Which of the following causes an infinite loop?
1. while (1) {...}
2. int i = 3;
while (i < 4) {...}
3. int i = 3
do {
...} while(i < 4)
4. All of the above
4 . All Of The Above
Ans.1 while(1){..}
Because the condition is always true
4
maybe A.
the first answer
!. while(1){...}
Very nice lecture. Thank you
Thanks I'm getting better at C
Where do I find answers to the test questions you give?
Ma'am lemme know the condition for "do ,loop" to print any table
I tried but couldn't 😑
programming is really hard for me but i love learning new things
Thank you so much!
The "do {} while var;" loop is beautiful 🤩
Thank you mam☺
You are amazing 👏🙌👏
/* Example 3. While program to print multiplication table from 10 to 0.*/
#include
int main(){
int number;
printf("Please enter a number to be multiplied: ");
scanf("%d", &number);
int count = 10;
while(count >= 0) /* This is the test expression*/
{
int product = count * number; /* This is the body of the do loop*/
printf("%d * %d = %d
", number, count, product);
--count;
}
return 0;
}
which one the causes is an infinite loop, is it B ?
Your tone accent is Indian are you Indian?
By the way you teach really well 😊 Thank you so much it helps so much!!
kindly do c++,pascal,C#,java and xml totorials plz
#include
int main (){
// multiplication table for a agiven, that prints from 10 to 1.
int number;
printf("Enter number: ");
scanf("%d", &number);
int count=10;
while(count>=1){
int product=number*count;
printf("%d*%d=%d
", number, count, product);
count = count-1;
}
return 0;
}
amazing teacher😍
great tutorials
Great video ❤
Extremely useful lectures ❤️🔥😀
By how much time all of advanced C programming course will be completed?
We will continue the series until all the important topics are covered. So stay tuned for new episode and a lot of other resources every week. Thank you for sticking with us.
Okay great 👍
Thanks 😊
@@programizstudios kindly do c++,pascal,C#,java and xml totorials plz
Can it get any shorter than that?
int num, count = 11;
printf("Enter number: ");
scanf_s("%d", &num);
while (count-- > 1) printf("%d x %d = %d
", num, count, num * count);
I love your videos
Is the answer of the quiz is option B?
#include
int main(){
int raajbhog = 1;
while(raajbhog
Thank you ❤❤❤❤❤
Thanks a lot
Is there a reason to not declare int product outside the while loop and then only use product = number * count; ?
might be a little late but you can declare your product whenever you want and can you some other variable expect product as long as you declare it
Upload all lecture as early as possible
good one
great keep going !
Love From Nepal
very nice😁
My question is why write %d what does it mean and second why inthe example code is there printf(enter number) and scanf(%d &number) what do they mean ... Please help
Watch their previous videos and you’ll understand
I am really bad at understanding difference between for,while and do while.So , please upload series of problems which can be solved efficiently only through while loop.
you need a computer science course not programming course,
explained in one sentence: FOR and DO WHILE is a "pre-test" loop but WHILE DO is a "post-test" loop
we can use decrement like count-- cant we
very nice
Very interseted in solving the code and understanding the concepts
so the code for the programming task is :
#include
int main() {
int number;
printf("Enter the number: ");
scanf("%d",&number);
int count=10;
while(count > 1){
int product = number * count;
printf("%d*%d = %d
", number,count,product);
count = count - 1;
}
return 0;
}
while doing the code, i realized that count++ can be used instead of count = count + 1; to look shorter and cleaner. the same with the programming task: c-- instead of count = count - 1;.
you can also use count+=1
table using do while loop :
#include
int main() {
// Write C code here
int number, count, product;
printf("Enter the number : ");
scanf("%d",&number);
count = 1;
do {
product = number * count;
printf("%d * %d = %d
",number, count, product);
count = count +1;
}
while (count
/*C program to print the sum of all odd numbers from 1 to 100*/
#include
int main(){
int sum = 0;
for (int i = 1; i
All of above
// Online C compiler to run C program online
// C program to print reverse table of any number
#include
int main() {
// Write C code here
int number;
printf("Table of: ");
scanf("%d", &number);
int count = 10;
while(count >= 1 ){
int product = number * count;
printf("%d * %d = %d
", number , count, product );
count = count - 1;
}
return 0;
}
Is answer option d
Programming Task:
#include
int main() {
int num=9;
int count=10;
int product;
do {
product=num*count;
printf("%d*%d=%d
", num, count, product);
count=count-1;
} while(count>=1);
return 0;
}
Programiz Quiz Answer: Option (D) All of the above
Beauty with brain ❤>
Thank you so much Mam.Your method of explaining is very amazing.Your lectures helped me a lot to get good marks in my exams.So much love from Pakistan💖💖
give us more programming tasks
Like daily tasks
We really love enthusiastic learners like you Adarsh. Do complete the programming task of this tutorials and of previous videos and hopefully we will bring other tasks and challenges really soon stay tuned.
I want more programming questions on single topic so that it can easily remember me the codeing
Coding*
//C Program to print the reverse multiplication table of n
#include
int main(){
int num;
int count=10;
int multiply;
printf("Enter a value: ");
scanf("%d", &num);
while (count>0){
multiply=num*count;
printf("%d * %d = %d
", num, count, multiply);
count=count-1;
}
return 0;
}
you can actually safe some bytes by making the multiply variable local instead of global since it wont be used in other places except the one call
int main(){
int num=9;
int counter=10;
while(counter>=1){
int result=num*counter;
printf("%d * %d = %d
",num,counter,result);
counter--;
}
}
answer is all of the above. i belive you forgot the semi-colon at the end of the do while loop
If the Explainer would be this " Beautiful😍💓 " Every ' Boring ' subject will automatically be interesting 😋 Am i Right✔ 🌹🥰
I wish 🥀i could have got her 👧 earlier, then now i could be an Expert at C programming 🤔
From now on " Am going to be a subscriber " Of yours 😃😋
ALL of the above
Option - A
ALL OF THE ABOVE
Lodi
The presenter is beautiful.
Thankyou !
Definitely she is!! :)
We know but please focus
😂😂😂@@williamsigoniseigha1348
If I, a man, called you beautiful at work, wouldn't that be an HR nightmare? 😅 I'm saying... what about the while loop? Isn't that beautiful?
#include
int main(){
int num;
int count = 10;
printf("Enter the number you want to multiply ");
scanf("%d", &num);
while (count >= 1){
int value = num *count;
printf ("%d*%d = %d
", num, count, value);
count--;
}
return 0;
}
Thank you Padma , I'm learnign C from last day.
Your teaching skill is just awesome, I'm really grateful to you .
Programming Task:
#include
int main() {
int number;
printf("Enter your number: ");
scanf("%d", &number);
int count = 12;
while (count >= 0) {
int product = number * count;
printf("%d*%d = %d
", number, count, product);
count = count - 1;
}
return 0;
}
opt A while(1){...} causes an infinite loop
#include
int main()
{
// declare variables
int n,m=10,o;
/* print variables
and take values*/
printf("number=");
scanf("%d",&n);
// declare loop
while (m > 0){
o=m*n;
printf("%dx%d=%d
",n,m,o);
m--;
}
// printing result
return 0;
}here it is
#include
Int main(){
Int num=9;
Int count=10;
While(count>=1){
Int product =count*num;
Printf("%d*%d=%d
, count,num,product);
Count=count-1;
}
return 0;
}
int main() {
int count=10;
while(count>=1){
int mul=9;
int product=mul*count;
printf("%d*%d=%d
",mul,count,product);
count=count-1;
}
return 0;
}
Programming task:
int main() {
int count = 10;
int num = 9; //multiplication table of 9
do {
int product = num * count;
printf("%d * %d = %d
", num, count, product);
count -= 1;
} while (count >= 1);
return 0;
}
what is count=count+1
it adds into a variable +1 to the number so if the initial value of count is 0 after the count=count+1 it is 1 .
A. while(1){....}
The answer of the quiz is D(all the above).
The answer of the quiz is 4
All above
D is the answer.
Answer D) Default
#include
Int main () {
Int number = 9;
Int count = 10;
While (count >0) {
Int result = number * count;
Printf("%d*%d = %d
, number, count, result;)
count = count - 1;
}
return 0;
}
option c
Answer is D) All of these
option 4
Write a program to ask for a name until the user enters END. Print the name each time. When you are done, print "I am done."
12:27 option A
#include
int main()
{
int number,count=10;
printf("Enter a number?");
scanf("%d",&number);
while(count>=1)
{
int product=number*count;
printf("%d x %d =%d
",number,count,product);
count=count-1;
}
}
is this correct?
answer:option D