اكتب برنامج C يقرأ الجانبين المتجاورين وقطر متوازي الأضلاع وتحقق مما إذا كان متوازي الأضلاع مستطيلًا أم معينًا
- برمجة
- برمجة سي c
- 2021-05-03
- Wassim
الأجوبة
/*Write a C program which reads the two adjoined sides and the diagonal of a parallelogram and check whether the parallelogram is a rectangle or a rhombus*/
#include <stdio.h>
main() {
int h1, h2, t;
int rect = 0;
int hisi = 0;
rect = 0;
hisi = 0;
printf("Input two adjoined sides of the parallelogram:\n");
scanf("%d", & h1);
scanf("%d", & h2);
printf("\nInput the diagonal of the parallelogram:\n");
scanf("%d", & t);
if (t * t == h1 * h1 + h2 * h2)
rect++;
if (h1 == h2)
hisi++;
if (rect > 0)
printf("\nThis is a rectangle.");
if (hisi > 0)
printf("\nThis is a rhombus.");
return (0);
}أسئلة مشابهة
القوائم الدراسية التي ينتمي لها السؤال