السؤال من كورس ال Programming الخاص بي

Write a C program to print a circle of stars, input = radius .

 

0

الحل مرفق

/**************************************************************************************************
 Name        : ex24.c
 Author      : Mohamed Elsayed
 Description : Assignment 1 - Ex 24
 **************************************************************************************************/
#include  
#include   

// function to print circle pattern 
void printPattern(int radius) { 

 // dist represents distance to the center 
 float dist; 

 // for horizontal movement 
 for (int i = 0; i <= 2 * radius; i++) { 

  // for vertical movement 
  for (int j = 0; j <= 2 * radius; j++) { 
   dist = sqrt((i - radius) * (i - radius) + (j - radius) * (j - radius)); 
   // dist should be in the range (radius - 0.5) 
   // and (radius + 0.5) to print stars(*) 
   if (dist > radius - 0.5 && dist < radius xss=removed>

لمزيد من التفاصيل يرجى التواصل معي

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

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

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

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