jawapan:
1) a) 5 * 2 % 3 + 25 / 5
= (5 * 2) % 3 + (25 / 5) settle bhgi n darab dlu
= (10 % 3) + 5 settle modulus dlu
= 1 + 5
= 6
b) a = 5 , b = 6
!(( a < 3 ) & & ( a = = 3 ) | | ( b > 9 ))
= !(( 5 < 3 ) & & ( 5 = = 3 ) | | ( 6 > 9 )) settle nilai a n b dlu
= !(( 0 ) & & ( 0 ) | | ( 0 )) tntukan samada 1/true or 0/false
= !(( 0 ) & & ( 0 ) | | ( 0 )) settle kn & & dlu
= !(( 0 ) | | ( 0 )) br settle kn | |
= !(0) klu !/not , jwpn mesti terbalik
= 1 / True
2) include<iostream.h> xde simbol #
mai() tetinggal hruf n
{
float allowance=300.00,salary;
cout<<''Input Salary=";
cin>salary; simbol salah >>
Tsalary=Sallary+Allowance; xyah letak T kat formula
cout<<"salary is="<<salary; pas output, mesti return 0;
}
JAWAPAN :
#include<iostream.h>
#include<iostream.h>
main()
{
//declare variable
float num1;
float num2;
float num3;
float num4;
float num5;
float total;
float average;
//input 1
cout<<"enter num1";
cin>>num1;
//input 2
cout<<"enter num2";
cin>>num2;
//input 3
cout<<"enter num3";
cin>>num3;
//input 4
cout<<"enter num4";
cin>>num4;
//input5
cout<<"enter num5";
cin>>num5;
//formula 1
total=num1+num2+num3+num4+num5;
//output 1
cout<<"total="<<total;
//formula 2
average=total/5;
//output 2
cout<<"average="<<average;
return 0;
}
5) FORMULA : area of rectangle = height * width
area of circle = 3.14 * radius * radius
area of triangle = 0.5 * height * base
#include<iostream.h>
main()
{
//declare variable
float height;
float width;
float radius;
float base;
float area_of_rectangle;
float area_of_circle;
float area_of_triangle;
//input 1
cout<<"enter height";
cin>>height;
//input 2
cout<<"enter width";
cin>>width;
//input 3
cout<<"enter radius";
cin>>radius;
//input 4
cout<<"enter base";
cin>>base
//formula 1
area_of_rectangle=height*width;
//output 1
cout<<"the area of rectangle is="<<area_of_rectangle;
//formula 2
area_of_circle=3.14*radius*radius;
//output 2
cout<<"the area of circle is="<<area_of_circle;
//formula 3
area_of_triangle=0.5*height*base;
//output 3
cout<<"the area of triangle is="<<area_of_triangle;
return 0;
}
JAWAPAN :
#include<iostream.h>
main()
{
float allowance=300.00,salary;
cout<<''Input Salary=";
cin>>salary;
salary=Sallary+Allowance;
cout<<"salary is="<<salary;
return 0;
return 0;
}
3) FORMULA : workingdays=day_of_month-non_working_days
monthlysalary=daily_salary*working_days
#include<iostream.h>
main()
{
//declare variable
float day_of_month;
float non_working_days;
float daily_salary;
float workingdays;
float monthlysalary;
//input 1
cout<<"total day of that month=";
cin>>day_of_month;
//input 2
cout<<"non working days is about =";
cin>>non_working_days;
//input 3
cout<<"daily salary is=";
cin>>daily_salary;
//formula 1
workingdays=day_of_month-non_working_days;
//output 1
cout<<"total working days is ="<<working_days;
//formula 2
monthlysalary=daily_salary*working_days;
//output 2
cout<<"the monthly salary is ="<<monthly_salary;
return 0;
}
4) FORMULA : total = num1 + num2 + num3 + num4 + num5
average = total/5
monthlysalary=daily_salary*working_days
#include<iostream.h>
main()
{
//declare variable
float day_of_month;
float non_working_days;
float daily_salary;
float workingdays;
float monthlysalary;
//input 1
cout<<"total day of that month=";
cin>>day_of_month;
//input 2
cout<<"non working days is about =";
cin>>non_working_days;
//input 3
cout<<"daily salary is=";
cin>>daily_salary;
//formula 1
workingdays=day_of_month-non_working_days;
//output 1
cout<<"total working days is ="<<working_days;
//formula 2
monthlysalary=daily_salary*working_days;
//output 2
cout<<"the monthly salary is ="<<monthly_salary;
return 0;
}
4) FORMULA : total = num1 + num2 + num3 + num4 + num5
average = total/5
#include<iostream.h>
main()
{
//declare variable
float num1;
float num2;
float num3;
float num4;
float num5;
float total;
float average;
//input 1
cout<<"enter num1";
cin>>num1;
//input 2
cout<<"enter num2";
cin>>num2;
//input 3
cout<<"enter num3";
cin>>num3;
//input 4
cout<<"enter num4";
cin>>num4;
//input5
cout<<"enter num5";
cin>>num5;
//formula 1
total=num1+num2+num3+num4+num5;
//output 1
cout<<"total="<<total;
//formula 2
average=total/5;
//output 2
cout<<"average="<<average;
return 0;
}
5) FORMULA : area of rectangle = height * width
area of circle = 3.14 * radius * radius
area of triangle = 0.5 * height * base
#include<iostream.h>
main()
{
//declare variable
float height;
float width;
float radius;
float base;
float area_of_rectangle;
float area_of_circle;
float area_of_triangle;
//input 1
cout<<"enter height";
cin>>height;
//input 2
cout<<"enter width";
cin>>width;
//input 3
cout<<"enter radius";
cin>>radius;
//input 4
cout<<"enter base";
cin>>base
//formula 1
area_of_rectangle=height*width;
//output 1
cout<<"the area of rectangle is="<<area_of_rectangle;
//formula 2
area_of_circle=3.14*radius*radius;
//output 2
cout<<"the area of circle is="<<area_of_circle;
//formula 3
area_of_triangle=0.5*height*base;
//output 3
cout<<"the area of triangle is="<<area_of_triangle;
return 0;
}
ni lah jawapan kitorang...sbb jawapan ni bincang dlm group...hehhehehehe....so far lah semua sama jek...cume bile create program tu ada jarak ada xjarak jek....xpe jnji faham ape yang kite buat....pas dah jawap kene buat sorang2 kat depan n then update kat blog masing2....huhuhuhuhu...siap sudah....
Tiada ulasan:
Catat Ulasan