BLOGGER TEMPLATES AND TWITTER BACKGROUNDS »

Sunday, March 6, 2011

exercise 1

1) Solve the equestion below solve the following :
a) 5 * 2 % 3 + 25 / 5

b) a = 5 ,b = 6
! ((a<3) && (a = = 3) ll (b > a)
2) identify the syntax errors in the following program
include <iostream.h>
mai ()
{
float allowance = 300.00 salary;
cout <<"input salary = ";
cin >salary;
Tsalary = salary + 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.
nie yg da wat programming:
4)write a program that allowance their average of 5 numbers that can be input by user.
answer:
#include <iostream.h>
main()
{
float no1;
float no2;
float no3;
float no4;
float no5;
float total;
float average;
//input 1
cout <<"num 1";
cin>> no1;
//input 2
cout<<"num 2";
cin>>no2;
//input 3
cout<<"num 3";
cin>>no3;
//input 4
cout<<"num 4";
cin>>no4;
//input 5
cout<<"num 5";
cin>>no5;
//formula
total = no1 + no2 + no 3 + no 4 + no 5
//output
cout <<"total"<<total;
//formula
average = total/5;
//output
cout<<"average"<<average;
return 0;
}

nie yg da jd wat programming

5)write a program that will calculate the area of rectangular,triangle and circle:
answer:
#include <iostream.h>
main ()
{
//declare variable
float height;
float weight;
float area_rectangle;
float radius;
aloat area_circle;
float area_triangle;
//input 1
cout<<"enter height";
cin>>height;
//input 2
cout <<"enter weight";
cin>>weight;
//input 3
cout<<enter radius";
cin>>radius;
//formula 1
area_rectangle = height * width;
//output 1
cout<<"area_rectangle ="<<area_rectangle;
formula 2
area_circle = 3.14 * radius * radius;
//output 2
cout <<"area_circle ="<<area_circle;
//formula 3
area_triangle = 0.5 * height * height;
//output 3
cout<<"area_triangle ="<<area_triangle;
return 0;
}

nie yg da jd wt programming

ok da siap pown...pnt glew wt nie...hehehehe

0 comments: