C++ Function Assignment
C++ Function Assignment
> =90 A+
>= 80 A
>= 70 B+
>= 60 B
>= 50 C
>=40 D
>=30 E
>= 0 F
2. This program shows the greatest
number between three numbers using if-else-if statement. It takes three numbers as
input from keboard and output the greatest number.
3. Write a C++ program to print out the following triangle
*
**
***
****
3. C++ program to find Fibonacci Series upto n=15.
4. Write a program using function which accept two integers as an argument and return its sum.
Call this function from main( ) and print the results in main( ).
5. Question 2 Write a function to calculate the factorial value of any integer as an argument.
Call this function from main( ) and print the results in main( ).
6. Question 3 Write a function that receives two numbers as an argument and display all prime
numbers between these two numbers. Call this function from main( ).
default:
cout<<"invalid grade entered";
break;
}
return 0;
}
C++ program to find Fibonacci Series upto given range. This C++ program use simple
logic to get the concept of writing code in C++ for Fibonacci Series
1. #include<iostream.h>
2. int main()
3. {
4. int range, first = 0, second = 1, fibonicci=0;
5. cout << "Enter Range for Terms of Fibonacci Sequence: ";
6. cin >> range;
7. cout << "Fibonicci Series upto " << range << " Terms "<< endl;
8. for ( int c = 0 ; c < range ; c++ )
9. {
10. if ( c <= 1 )
11. fibonicci = c;
12. else
13. {
14. fibonicci = first + second;
15. first = second;
16. second = fibonicci;
17. }
18. cout << fibonicci <<" ";
19. }
20. return 0;
21. }
========================================================================================================================
#Include<include .h>
int main(int argc, char *argv[])
{
//Switches (case Structure) //
int marks;
cout<<"\t\nEnter the makrs = ";
cin>>marks;
cout<<"\t\nCongratulations Your Grade is = ";
switch (marks)
{
case 90:
cout<<"A\n\n\n";
break;
case 80:
cout<<"B\n\n\n";
break;
case 70:
cout<<"C\n\n";
break;
default:
cout<<"Sorry Try Again Student\n\n";
break;
}
system("PAUSE");
return 0;
}
In a company an employee is paid as under:
If his basic salary is less than Rs. 1500, then HRA = 10% of basic salary and DA = 90% of basic
salary.
If his salary is either equal to or above Rs. 1500, then HRA = Rs. 500 and DA = 98% of basic
salary.
If the employee's salary is input by the user write a program to find his gross salary.
Write a program to enter the numbers till the user wants and at the end it should display the
maximum and minimum number entered