need a code for problem no. 5.. language should be same like question no. 4....
ID: 3871505 • Letter: N
Question
need a code for problem no. 5..
language should be same like question no. 4....
Explanation / Answer
Q4)
main()
{
//declare the variables for sex and marital status
int sex, mart_sta;
//declare the variable for age,tax,pre_ext
int age, taxes, pre_ext;
//display message to accept sex and marital status
printf("Enter SEX and MARITAL status ");
//accept the sex and marital status
scanf("%d%d", &sex, &mart_sta);
//display message to accept tax, age, condition
printf("AGE Taxes PAID or NOT ANY PRE EXISTING CONDITIONS and AGE ");
//accept message to accept tax, age, condition
scanf("%d%d%d", &age, &taxes, &pre_ext);
{
/* to check marital status = m or marital status is unmarried and sex male and age >25 and tax=1
* or marital status is unmarried and sex female and age >>30 and tax=1 or pre_ext = then
* GRANT INSURANCE
* else
* REFER TO REGIONAL OFFICE: REQUEST FOR FURTHER INFORMATION
*/
if ((mart_sta == 'M') || (mart_sta == 'U' && sex == 'M' && age > 25 && taxes == 1) || (mart_sta == 'U' && sex == 'F' && age > 30 && taxes == 1) || (pre_ext == 1)) {
printf("GRANT INSURANCE ");
} else
printf("REFER TO REGIONAL OFFICE: REQUEST FOR FURTHER INFORMATION");
}
}
Q 5)
#include <stdio.h>
#include <stdlib.h>
# include <math.h>
main() {
float a,b,c; //sides of the triangle
float area,s; // to calculate the area and side
//accepts from the user, three sides of a triangle
printf(" Enter the value for A : ");
scanf("%f",&a);
printf(" Enter the value for B : ");
scanf("%f",&b);
printf(" Enter the value for C : ");
scanf("%f",&c);
//area calculation
s = (a+b+c) /2;
area = sqrt(s*(s-a)*(s-b)*(s-c));
//displays the result
printf(" The sides of the triangle is : %f",s);
printf(" The Area of the triangle is :%f",area);
// checks for the right angled triangle
if(c==(sqrt(a*a)+(b*b)))
printf(" It's a right angled triangle.");
else
printf(" It's not a right angled triangle.");
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.