Professional Documents
Culture Documents
PF Assignment No. 4
PF Assignment No. 4
ASSIGNMENT NO. 4
PROGRAMING FUNDANETAL
int main(){
int a, b;
cin>>a;
cin>>b;
// calling the function to calculate the sum and storing the result in variable s
return 0;
}
Screenshot:
Q2: Define two functions to print the maximum and the minimum number
respectively among three numbers entered by user.
Code:
#include<iostream>
int m = num1;
return m;
int m = num1;
return m;
int main(){
int a, b, c;
cin>>a>>b>>c;
// calling the functions to find the maximum and minimum of the three numbers and displaying the results
return 0;
}
Screenshot:
Q3: A person is eligible to vote if his/her age is greater than or equal to 18. Define a
function to find out if he/she is eligible to vote.
Code:
#include<iostream>
int main(){
int a;
cin>>a;
// calling the function to check if the person is eligible to vote and displaying the result
return 0;
}
Screenshot:
Q4: Write a program which will ask the user to enter his/her marks (out of 100).
Define a function that will display grades according to the marks entered as below:
Marks Grade
91-100 A+
81-90 A
71-80 B
61-70 C
51-60 D
41-50 E
Code:
#include<iostream>
int main(){
int marks;
cin>>marks;
// calling the function to display the grade based on the marks obtained
displayGrade(marks);
return 0;
}
Screenshot: