Monday, March 7, 2011


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>
    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 .                                                                                            
 answer :
# include <iostream.h>
main ()
{
// declare variable
float noworkingdays;
f[oat salaryperdays;
float monthlysalary;
// input 1
cout <<"enter noworkingdays";
cin>> noworkingdays;
// input 2
cout <<"enter salaryperdays=";
cin>>"salaryperdays;
formula
monthly salary=noworkingdays*salaryperdays";
//output
cout<<"monthysalary<<monthlysalary;
return o
}


4.write a program that allowance their everage of 5 numbers that can be input by user.


answer:
# include < iostream.h>
main()
{
float no1
float no2
float no3
float no4
float no5
total average // input 1
cout<<"num 1";
cin>>num 1;
// input 2
cout<<"num 2";
cin>>num 2;
// input 3
cout<<"num 3";
cin>> num 3;
// input 4
cout<<" num 4";
cin>> num 4;
// input 5
cout<<"num5";
cin>> nmu 5;
// formula1
total= num1+num2+nmu3+num4+num5
// 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