Professional Documents
Culture Documents
Name Naqeeb Ullah Id 33662 Assignment No 1
Name Naqeeb Ullah Id 33662 Assignment No 1
Id 33662
Assignment no 1
Q1: Multiply five numbers with your ID by using Europe Method, American
Method, and Russian Method?
Ans: Russian Method of Multiplication: -
33833*98765=3341516245
33833 98765
16916 197530
8458 395060
4229 790120
2114 1580240
1057 3160480
528 6320960
264 12641920
132 25283840
66 50567680
33 101135360
16 202270720
8 404541440
4 809082880
2 1618167760
1 3236331520
3*12 = 36
3*34 = 1020
3*5 = 15
I= 33833 II = 33833
* 12345 * 98765
417668385 3341516245
\r: - \r is a carriage return character; it tells your terminal emulator to move
the cursor at the start of the line. The cursor is the position where the next
characters will be rendered. So, printing a \r allows to override the current
line of the terminal emulator.
Unsigned Integer: -
Ans:
#include<iostream>
using namespace std;
int main()
{ char ch;
cout<<"Enter any character: ";
cin>>ch;
if(ch>=65&&ch<=90)
cout<<"You entered "<< ch<<endl<<"You entered an uppercase character";
else if(ch>=48&&ch<=57)
cout<<endl<<"You entered a digit";
else if(ch>=97&&ch<=122)
cout<<"You entered "<< ch<<endl<<"You entered a lowercase character";
return 0;
}
Q7: What is the ASCII Code of small alphabet; capital alphabet and
digits?
Ans: Following are the ASCII code of small alphabet large alphabet and digits
ASCII value of lowercase alphabets = 97 to 122.
Q8: Does modulus work with float, int and float, float and int?
Ans: Modulus Division operator % in C++ language does not work with float,
int and float, float and int. because modulus division operator can be used only
with integer variables or constants.
Start
Enter Marks
Calculate %age
If
Yes Grade =A
%age>=90
&<=100
No
Else if
Yes
%age>=80 Grade =B+
&<=89
Else if
Grade =B
%age>=70
No &<=79
Yes
No Else if YES
%age>=60 Grade =C
&<=69
No
Else
%age<60
Grade =Fail
Stop
doff
Q11: Write down the pseudo code of GPA and make its flow chart?
Ans: Pseudo Code:
1. Enter your grade
2. If(grade=A)
3. GPA is 4/4
4. Else
5. if(grade=B+)
6. GPA is 3.5/4
7. Else
8. if(grade=B)
9. GPA is 3.0/4
10. Else
11. if(grade=C+)
12. GPA is 2.5/4
13. Else
14. if(grade=C)
15. GPA is 2.0/4
16. Else
17. F grade
Start
Enter Marks
Calculate %age
If
Yes A = 4 GPA
%age>=90
&<=100
No
Else if
%age>=80
Yes
B+= 3.5GPA
NO
Else if Yes
%age>=70 B= 3.0 GPA
&<=79
No
Else if
%age>=60&
Yes
C+= 2.5GPA
<=69
No
Yes
Else
C=2.0 GPA
%age<60
No
Grade =Fail
Stop
doff