2020-10-10
  • |
  • daafoor
  • |
  • مشاهدات: 2162

برنامج يطبع الاعداد من 1 الى 5 باستخدام Do While :

#include
 
int main ()
{
   /* 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 );
 
   return 0;
}

 

كود برنامج ادخال ارقام يتوقف عند ادخال الرقم صفر :

// Program to add numbers until the user enters zero

#include 
int main()
{
    double number, sum = 0;

    // the body of the loop is executed at least once
    do
    {
        printf("Enter a number: ");
        scanf("%lf", &number);
        sum += number;
    }
    while(number != 0.0);

    printf("Sum = %.2lf",sum);

    return 0;
}

ابحث عن مسائل برمجة سي c | C programming بالانجليزي

هل أعجبك المحتوى؟

محتاج مساعدة؟ تواصل مع مدرس اونلاين الان!

التعليقات
لا يوجد تعليقات
لاضافة سؤال او تعليق على المشاركة يتوجب عليك تسجيل الدخول
تسجيل الدخول