برنامج يطبع الاعداد من 1 الى 5 باستخدام Do While :
#includeintmain(){/* local variable Initialization */int n =1,times=5;/* do loops execution */do{printf("C do while loops: %d\n", n);
n = n +1;}while( n <= times );return0;}
C
كود برنامج ادخال ارقام يتوقف عند ادخال الرقم صفر :
// Program to add numbers until the user enters zero#includeintmain(){double number, sum =0;// the body of the loop is executed at least oncedo{printf("Enter a number: ");scanf("%lf",&number);
sum += number;}while(number !=0.0);printf("Sum = %.2lf",sum);return0;}