Ni exercise yg miss ayuni bg, urmmm. Susah beb. Nik pening ak nk buat..
Nasib baek ade kawn2 yg tlg ajarkan... thank frens..
1) a) 5 * 2 % 3 + 25 / 5
= (5 * 2) % 3 + (25 / 5) settle bhgi nan 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 )) msok kn nilai a nan b dluAA
= !(( 0 ) & & ( 0 ) | | ( 0 )) tntukan true / 1 or false / 0
= !(( 0 ) & & ( 0 ) | | ( 0 )) settle kn & & dlu
= !(( 0 ) | | ( 0 )) br settle kn | |
= !(0) klu not / !, kne tebalek kn
= 1 / True
2) Identify the syntex error in the following program
include<iostream.h> x letak simbol #
mai() ejaan sala, tetinggal hruf n
{
float allowance=300.00,salary;
cout<<''Input Salary=";
cin>salary; sala simbol, ptot nye >>
Tsalary=Sallary+Allowance; formula sala, hruf T x perlu ade
cout<<"salary is="<<salary; lpas output, kne ltax return 0;
}
JAWAPAN :
#include<iostream.h>
JAWAPAN :
#include<iostream.h>
main()
{
float allowance=300.00,salary;
cout<<''Input Salary=";
cin>>salary;
salary=Sallary+Allowance;
cout<<"salary is=”<<salary;
}
3.write a program that will calculate the monthly salary for an employee that where saturday&sunday are considered as non working days .
// output
cout<<"total"<<total;
// formula
average=total / 5
// output 2
cout<<"average"<<average;
return o
{
5.write a program that win calculate the area of rectangular,triangle&circle.
answer:
# include<iostream.h>
main()
}
// declare variable
float heigh;
float widh;
float area rectangle;
float radius;
float area circle;
float height;
float area triangle
// input 1
cout <<"enter height";
cin>>height;
// input 3
cout<<"enter width";
cin>>width;
//input 3
cout<<"enter radius";
cin >> radius;
// formula
area-rectangle=heightr*width;
// output 1 cout<<"area-rectangle="area-rectangle;
//formula 2
area-circle=3.14*radius*radius;
// output2
cout<<"area-circle="<<area-circle;
// formula 3
area=triangle=0.5*height*height;
// output3cout<<"area-triangle;"area -trinagle;
return o;
}
No comments:
Post a Comment