#14 : break and continue in C | C Programming for Beginners

preview_player
Показать описание
#14: break and continue in C | C Programming for Beginners

In this video, we will learn about the break and continue statements to alter the normal flow of loops in C programming. We will show you how you can use the break statement to terminate the loop and the continue statement to skip the current iteration. You will learn many examples of using break and continue with while loop along with using if...else condition.

~
Resources:

Timestamps:
00:00 Start
00:16 break Statement
01:36 break Statement with decision-making statement
03:17 break with while Loop
05:18 continue Statement
07:08 Example: break and continue
09:29 Programming Task
10:10 Quiz
~

Revise your learning using our C App

Find Programiz elsewhere:

#programiz #learncprogramming #breakandcontinue #learnc #break #continue #loop #C
Рекомендации по теме
Комментарии
Автор

🔥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!

programizstudios
Автор

no teacher at university explains these so well🖤🖤🖤

vexpomegran
Автор

Your explanations are simplified. Thank you!

OgaPita
Автор

you and bro code might be the best coding teachers out there that can explain this 👍

awesomeswordsman
Автор

Thank you for posting valuable content of C programming..

lalith_kumar_akhila
Автор

Very well explained, this is what we're struggling when we're start coding as a beginner. Here the basics is covered well, and I'm really grateful for it. This eventually will help most of the enthusiastic learners.

ntnmfbu
Автор

Thanks a lot guys for your sessions .... thanks @padma

sahalyoosuf
Автор

These videos are very helpful. ThankYou!

pranavsilla
Автор

//Can you write a prpgram that takes an input from the user and prints it if the value is a negative odd number?
//*If the input value is positive, end the loop with message, 'Positive Value'
//*If the input value is negative even, skip the value with message 'Negative Even'

#include <stdio.h>
int main()
{
int number;
while(1)
{
printf("Enter a number:");
scanf("%d", &number);

if(number < 0)
{
if(number % 2 != 0)
{
printf("%d\n", number);
continue;
}
printf("Negative Even\n");
continue;
}
printf("Positive Value");
break;
}
}

harshadatapre
Автор

This video is most valuble for programming beginners ❤️ can you do video for c programming functions ? 🌸😊

rythmflow
Автор

Hi Padma, unfortunately my code for printing positive numbers keeps saying number is undeclared yet it’s the same as yours

cheftelma
Автор

09:29 Programming Task
#include <stdio.h>

int main()
{
int i, j=0;
while(j<=5)
{
printf("\nEnter a value: ");
scanf("%d", &i);
if(i<0)
{
if(i%2==0)
printf("Negitive even number");
else
printf("Negitive odd number ");
}
else if (i>0)
{
if(i%2==0)
printf("Positive even number");
else
printf("Positive odd number");
}
else
printf("Neither be negitive or positive");
j++;
}
return 0;
}

chitturoyal
Автор

//A Program that takes input and prints if the value is a Negative odd number
#include <stdio.h>
int main(){
while (1){
int number;
printf("Enter a number: ");
scanf("%d", &number);
if (number>0) {
printf("Positive Value");
break ;
}
if (number <= 0 && (number%2)!=0) {
printf("Negative Even\n");
continue;
}
}
return 0;
}

oissimouni
Автор

Answer for Programming Task today
#include <stdio.h>
int main(){
while(1){
int num;
printf("Enter a number:");
scanf("%d", &num);

if(num < 0){
if((num % 2) != 0){
printf("%d\n", num);
}
else{
printf("Negatif Even\n");
continue;
}
}
else{
printf("Positif value");
break;
}
}

return 0;
}

marusukech.
Автор

Ma'am at 5:53 in one place i=1 and other place i==3
For equal to two sign are used what's the reason ?

vikkyd
Автор

Continue is usedd to skip the current iteration

SambanaCharmila
Автор

Hi, I like to print numbers 1 to 25 in five rows and 5 columns continuously and wish ‘22’ and ‘23’ to be skipped, using the ‘continue’ in a for loop as follows:
#include <stdio.h>
#include <stdlib.h>

int main()
{
int i, j, n=5;
int x=1;
for (i=1;i<=n;i++)
{
for(j=1;j<=n;j++)
{
if (x>21 && x<24)
continue;
printf("%2d ", x);
x++;
}
printf("\n");
}
return 0;
}
And I get an putput as follows:
1 2 3 4 5
6 7 8 9 10
11 12 13 14 15
16 17 18 19 20
21
Where 24 and 25 are missing.
How to solve this one?
17-5-22

karunanithir
Автор

//programming task
#include <stdio.h>

int main()
{
while(1)
{
int num;
printf("input your num:");
scanf("%d", &num);

if(num>0)
{
printf("positive value");
break;
}
if((num %2) == 0)
{
printf("negative even\n");
continue;
}
printf("your num is %d\n", num);
}

return 0;
}

mv