اذهب إلى المحتوى
  • 4

حل مسائل بلغه c

مصعب عبد الكريم

السؤال

أرجو حل هذه المسائل الاتيه :

1- write a C program that allow user to enter the value of base and height of triangle and then calculate the area of triangle by the following equation:

area = 0.5*base*height

and then that print the area?

 

2-write a C program that allow user to enter the radius of circle then calculate and print the area of circle by using the equation:

 area=PI*raduis2 , where PI constant and its value=3.14

وشكرآ

رابط هذا التعليق
شارك على الشبكات الإجتماعية

Recommended Posts

  • 0

مساحة المثلث

#include <stdio.h>

int main()
{
    float base, height, area;

    /* Input base and height of triangle */
    printf("Enter base of the triangle: ");
    scanf("%f", &base);
    printf("Enter height of the triangle: ");
    scanf("%f", &height);

    /* Calculate area of triangle */
    area = .5* base * height;

    /* Print the resultant area */
    printf("Area of the triangle = %.2f sq. units", area);

    return 0;
}

مساحة الدائرة

#include<stdio.h>

#define PI 3.14

main()
{
  float radius, area, circumference;

  printf("\n Please Enter the radius of a circle\n");
  scanf("%f",&radius);

  area = PI*radius*radius; 
  circumference = 2* PI*radius;

  printf("\n Area Of a Circle = %.2f\n", area);
  printf("\n Circumference Of a Circle = %.2f\n", circumference);

  return 0;
}

 

رابط هذا التعليق
شارك على الشبكات الإجتماعية

  • 0

Write a C program that calculates and print the sum of all numbers from 1 to n, knowing that n are integers entered by the user, then calculates and prints the average of them

 

 

Write a program that uses a while loop to display values from –5 through 5, using an increment of 0.5

 

ارجو الاجابة باسرع وقت

رابط هذا التعليق
شارك على الشبكات الإجتماعية

انضم إلى النقاش

يمكنك أن تنشر الآن وتسجل لاحقًا. إذا كان لديك حساب، فسجل الدخول الآن لتنشر باسم حسابك.

زائر
أجب على هذا السؤال...

×   لقد أضفت محتوى بخط أو تنسيق مختلف.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   جرى استعادة المحتوى السابق..   امسح المحرر

×   You cannot paste images directly. Upload or insert images from URL.

  • إعلانات

  • تابعنا على



×
×
  • أضف...