Break and continue statement in C

753 views

Published on

Explanation of break and continue statements in C language.

Published in: Education
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
753
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
45
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Break and continue statement in C

  1. 1. Break and Continue statement
  2. 2. Break Statement
  3. 3. June Result Re-valuation Result December Result Normal Study Period Study Period if subject is cleared in the revaluation process
  4. 4. #include<stdio.h> #include<conio.h> main() { ………………………………. ………………………………. ………………………………. while(condition) { ……………. ……………. If condition becomes true if(condition) break; ……………. ……………. ……………. increment or decrement; } …………………………………. …………………………………. …………………………………. getch(); }
  5. 5. Prime Number . , , , , ….! , , , , , , , : , ….!
  6. 6. #include<stdio.h> #include<conio.h> void main() { int num, i; clrscr(); printf(“Enter Numbert”); scanf(“%d”, &num); i = 2; while(i < num – 1) { if(num % i == 0) { printf(“Numbers is not primen”); break; } i++; } if(i == num) printf(“Number is primen”); getch(); }
  7. 7. Enter Number Number is prime _ 5
  8. 8. Enter Number Number is prime _ 37
  9. 9. Enter Number Number is Not prime Number is prime _ 25
  10. 10. Enter Number Number is Not prime _ 25
  11. 11. #include<stdio.h> #include<conio.h> void main() { int num, i; clrscr(); printf(“Enter Numbert”); scanf(“%d”, &num); i = 2; while(i < num – 1) { if(num % i == 0) { printf(“Numbers is not primen”); break; } i++; } if(i == num) printf(“Number is primen”); getch(); } 25 num 2 i
  12. 12. Continue statement for(i = 1; i < 10; i++) { do this; If condition is do this; true if(condition) continue; do this; If condition is do this; false }
  13. 13. 5 10 15 20 25 30 35 40 45 50 _
  14. 14. #include<stdio.h> #include<conio.h> void main() { int j; clrscr(); for(j=1; j<=50; j++) { if(j % 5 != 0) continue; printf(“%dn”, j); } getch(); } When j is not divisible by 5

×