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”
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
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:
____________________________________________
MENU PILIHAN
____________________________________________
1.Pendaraban
2.Pembahagian
__________________________________________
Masukkan nombor pertama:4
Masukkan nombor kedua:8
Masukkan pilihan anda:1
Hasil darab 4 8 ialah 32
QUESTION NO 4
Change the algebra expression to anathematic expression:
QUESTION NO 5
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
QUESTION NO 6
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;
QUESTION NO 7
Convert the while statement below for statement
int j=10; while (j>0)
{
cout<<" "<
}
QUESTION NO 8
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
main ()
{
int k;
float P,total,average;
K=1
while (k<=4)
{
cout<<"Enter price"<
k++; total=total+P;
}
average=total/4;
cout<<"your total is"<
}
No comments:
Post a Comment