









Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
A basic introduction to loops in Language C
Typology: Lecture notes
1 / 15
This page cannot be seen from the preview
Don't miss anything!










variable initialization; while(condition) { statements; variable increment or decrement; }
#include<stdio.h> void main () { int j = 1; while (j+=2,j<=10) { printf("%d ",j); } printf("%d",j); }
#include<stdio.h> void main () { while () { printf("hello Javatpoint"); } } Output compile time error: while loop can't be empty
#include<stdio.h> #include<conio.h> int main() { int num=1; //initializing the variable //do-while loop do { printf("%d\n",2*num); num++; //incrementing operation } while(num<=10); return 0; }
#include<stdio.h> void main() { int a, i; a = 5; i = 1; do { printf("%d\t", a*i); i++; } while(i <= 10); }