ASSIGNMENT PF Lab 01
ASSIGNMENT PF Lab 01
PROGRAMMING FUNDAMENTALS -
LAB
FROM:
Muhammad Iltamas Riasat
ASSIGNED TO:
Mrs. Aqsa Sarfaraz
SECTION:
BS Software Engineering, Sec – B
ROLL NO:
065
DATE:
27th – Nov – 2023
Ques 01: Write a program which contain two different
techniques to swap numbers in C ++ programming. The first
program uses temporary variable to swap numbers, whereas
second program doesn’t use temporary variable?
Ans:
#include<iostream>
using namespace std;
int main()
{
int first_num, second_num, temp;
cout<<"Enter 1st Number=";
cin>>first_num;
temp=first_num;
first_num=second_num;
second_num=temp;
int main()
{
char a;
cout<<"Enter any alphabet: ";
cin>>a;
if(a=='A' || a=='E' || a=='I' || a=='O' || a=='U' )
cout<<"It is a vowel";
else if(a=='a' || a=='e' || a=='i' || a=='o' || a=='u' )
cout<<"It is a vowel";
else
cout<<"It is a consonant";
}
Ques 03: In this program, user in asked to enter two intergers
(divisor and dividend) and computed the quotient and
remainder?
Ans:
#include<iostream>
using namespace std;
int main()
{
int dividend, divisor, quotient, remainder;
cout<<"Enter the dividend=";
cin>>dividend;
return 0;
}
Ques 04: Write a C++ program that calculates the are of length of
a concave lens by taking radius of are and angle made by are
Formula (Length= radius x angle)?
Ans:
#include<iostream>
using namespace std;
int main ()
{
double radius, angle, length;
return 0;
}