Fill in the blank with appropriate data type for the
following variables declaration syntax :
a) __________Number 1=1
b) __________Number 3=3.0
c) __________Text 1=”1 have a car”
d) __________Huruf = “B”
e) __________AccountNo =”6666666443”
ANSWER NO 1
a) int Number 1=1
b) float Number 3=3.0
c) string Text 1=”1 have a car”
d) char Huruf = “B”
e) int AccountNo =”6666666443”
ANSWER NO 2
a) int Number 1=1
b) float Number 3=3.0
c) string Text 1=”1 have a car”
d) char Huruf = “B”
e) int AccountNo =”6666666443”
QUESTION NO 2
You are given PTPTN loan with the amount of RM1600.Calculate the amount that you should pay after PTPTN discount based on CGPA.You must use IF…ELSE Statement:
CGPA Diskaun
4.00 100%
3.99 – 3.00 80%
2.99 – 2.00 40%
0 – 1.99 0%
Contoh output:
Jumlah pinjaman: RM16000.00
CGPA yang diperolehi:3.00
Diskaun:RM 12800
Jumlah oinjaman yang perlu dibayar selepas diskaun: RM3200
You are given PTPTN loan with the amount of RM1600.Calculate the amount that you should pay after PTPTN discount based on CGPA.You must use IF…ELSE Statement:
CGPA Diskaun
4.00 100%
3.99 – 3.00 80%
2.99 – 2.00 40%
0 – 1.99 0%
Contoh output:
Jumlah pinjaman: RM16000.00
CGPA yang diperolehi:3.00
Diskaun:RM 12800
Jumlah oinjaman yang perlu dibayar selepas diskaun: RM3200
ANSWER NO 2
QUESTION NO 3
You are required to do a program that will execute the multiply or divide operation.The operation is based on the user’s choice.You must use SWITCH-CASE STATEMENT:
Output.
You are required to do a program that will execute the multiply or divide operation.The operation is based on the user’s choice.You must use SWITCH-CASE STATEMENT:
Output.
____________________________________________
MENU PILIHAN
____________________________________________
1.Pendaraban
2.Pembahagian
__________________________________________
Masukkan nombor pertama:4
Masukkan nombor kedua:8
Masukkan pilihan anda:1
Hasil darab 4 8 ialah 32
Change the algebra expression to anathematic expression:
ANSWER NO4.
i) y=(m-4ax)/79
ii) y=6bc/(45s-2xy)
iii) y=((2+AB+C)/3d)+5xyz
iv) y=(2kb/2ki)-3jb
v) y=xy+x*x-2ab
QUESTION NO 5
Solve the statement below to find m value show the working.
Solve the statement below to find m value show the working.
a) m=5
m*=m(3+4)*2
b) m=2
m*=((3*4)1/2)-9
a) m=5
m*=m(3+4)*2
m=5*5(7)*2
m=25*14
m=350
b) m=2
m*=((3*4)1/2)-9
m=2*(12*1/2)-9
m=2*6-9
m=12-9
m=3
QUESTION NO 6
Find the output for the following segment.
Find the output for the following segment.
a) float var 1=25.12, var 2=15.0;
if (var 1<=2)cout<<"var1 less or same as var2";
else cout<<"var1 bigger than var2";
b) in n=20; n/=5;
a)
float var 1=25.12, var 2=15.0;
if (var 1<=2)
cout<<"var1 less or same as var2";
else
cout<<"var1 bigger than var2";
output:
if(25.12<=2)
var 1 bigger than var 2
b)
int n=20;
n/=5;
output:
n=n/5
n=20/5
n=4
QUESTION NO 7
Convert the while statement below for statement
int j=10; while (j>0)
{
cout<<" "<
J--J
}
Convert the while statement below for statement
int j=10; while (j>0)
{
cout<<" "<
}
int j;
for(j=10;j>0;j--)
{
cout<<" "<
}
for(j=10;j>0;j--)
{
cout<<" "<
}
Write of program that needs 4 prices using while loop
and calculate the sum of the thing a program must
use function while for calculate the average of the
prices.
#include
{
int k;
float P,total,average;
K=1
while (k<=4)
{
cout<<"Enter price"<<k<<"=j;
cin>>P;
k++; total=total+P;
}
average=total/4;
cout<<"your total is"<<total<<"and average="" is"average;=""
return 0;
}