0% found this document useful (0 votes)
35 views2 pages

C# Type Casting and Game Number Solutions

The document contains 3 coding solutions: 1. Type casting a string to an integer and printing the result 2. A game number program that takes user input, performs calculations, and compares the predicted sum 3. A mark sheet program that takes subject marks as user input, displays the subjects and marks, and calculates the total marks

Uploaded by

Haji Zubair
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views2 pages

C# Type Casting and Game Number Solutions

The document contains 3 coding solutions: 1. Type casting a string to an integer and printing the result 2. A game number program that takes user input, performs calculations, and compares the predicted sum 3. A mark sheet program that takes subject marks as user input, displays the subjects and marks, and calculates the total marks

Uploaded by

Haji Zubair
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Assignment # 2: Date: 04-03-19

Solution # 1. Type Casting

string D = "15";
int j = Convert.ToInt32(D);
[Link](j);

[Link]();

Solution # 2. Game Number

int num1,predict_ans,num2,Sys_num1,num3,num4,sys_num2,num5,sum;
[Link]("enter First number by user:");
num1 = Convert.ToInt32([Link]());
predict_ans = num1 - 2;
[Link]("predict_ans="+2+predict_ans);
[Link]("enter 2nd number by user:");
num2 = Convert.ToInt32([Link]());
[Link]("generate system number for me");
Sys_num1 = Convert.ToInt32([Link]());
num3 = Sys_num1 - num2;
[Link]("enter 4th number by user:");
num4=Convert.ToInt32([Link]());
[Link]("generate 2nd system number for me:");
sys_num2=Convert.ToInt32([Link]());
num5 = sys_num2 - num4;
sum = num5 + num4 + num3 + num2 + num1;
[Link]("Actual answer is equal to predicted sum="+sum);
[Link]();
Solution# 3. Mark Sheet

int Total_Marks;
[Link]("\t\t\t\tMARK SHEET FOR POST GRADUATE
DIPLOMA / CERTIFICATE\n\n");
[Link]("enter subjects marks by user:\n\n");
int sub_1 = Convert.ToInt32([Link]());
int sub_2 = Convert.ToInt32([Link]());
int sub_3 = Convert.ToInt32([Link]());
int sub_4 = Convert.ToInt32([Link]());
int sub_5 = Convert.ToInt32([Link]());

[Link]("\nProgramming

Language\t\t"+sub_1+"\nQuantitative Method\t\t"+sub_2+"\nSys

A&D\t\t\t\t"+sub_3+"\nNetWorking\t\t\t"+sub_4+"\nOperating

System\t\t"+sub_5);

Total_Marks = sub_1 + sub_2 + sub_3 + sub_4 + sub_5;

[Link]("\n\nTotal Marks\t\t\t" + Total_Marks);


[Link]();

You might also like