SlideShare a Scribd company logo

namespace Habib_OLA4 { internal class Program { .pdf

namespace Habib_OLA4 { internal class Program { private int[] digits; public BigNumber() { digits = new int[40]; } public void Input(string input) { int startIndex = 0; bool isNegative = false; if (input[0] == '-') { isNegative = true; startIndex = 1; } for (int i = 0; i < digits.Length; i++) { digits[i] = 0; } for (int i = startIndex; i < input.Length; i++) { digits[digits.Length - input.Length + i] = input[i] - '0'; } if (isNegative) { Negate(); } } public override string ToString() { int startIndex = 0; while (startIndex < digits.Length - 1 && digits[startIndex] == 0) { startIndex++; } if (digits[startIndex] < 0) { return "-" + new BigNumber(digits).ToString(); } char[] chars = new char[digits.Length - startIndex]; for (int i = 0; i < chars.Length; i++) { chars[i] = (char)(digits[startIndex + i] + '0'); } return new string(chars); } public BigNumber Add(BigNumber other) { BigNumber result = new BigNumber(); int carry = 0; for (int i = digits.Length - 1; i >= 0; i--) { int sum = digits[i] + other.digits[i] + carry; result.digits[i] = sum % 10; carry = sum / 10; } return result; } public BigNumber Subtract(BigNumber other) { BigNumber result = new BigNumber(); int borrow = 0; for (int i = digits.Length - 1; i >= 0; i--) { int difference = digits[i] - other.digits[i] - borrow; if (difference < 0) { difference += 10; borrow = 1; } else { borrow = 0; } result.digits[i] = difference; } return result; } public bool IsEqualTo(BigNumber other) { for (int i = 0; i < digits.Length; i++) { if (digits[i] != other.digits[i]) { return false; } } return true; } public bool IsNotEqualTo(BigNumber other) { return !IsEqualTo(other); } public bool IsGreaterThan(BigNumber other) { for (int i = 0; i < digits.Length; i++) { if (digits[i] > other.digits[i]) { return true; } else if (digits[i] < other.digits[i]) { return false; } } return false; } public bool IsLessThan(BigNumber other) { for (int i = 0; i < digits.Length; i++) { if (digits[i] < other.digits[i]) { return true; } else if (digits[i] > other.digits[i]) { return false; } } return false; } public bool IsGreaterThanOrEqualTo(BigNumber other) { for (int i = 0; i > digits.Length; i++) { if (digits[i] > other.digits[i]) { return true; } else if (digits[i] < other.digits[i]) { return false; } } return false; } public static void Main(string[] args) { BigNumber integer1 = new BigNumber(); BigNumber integer2 = new BigNumber(); Console.Write("Enter first BigNumber: "); integer1.Input(Console.ReadLine()); Console.Write("Enter second BigNumber: "); integer2.Input(Console.ReadLine()); Console.WriteLine($"BigNumber 1: {integer1}"); Console.WriteLine($"BigNumber 2: {integer2}"); BigNumber result; // add two BigNumbers result = integer1.Add(integer2); Console.WriteLine($"Add result: {result}"); // subtract two BigNumbers result = integer1.Subtract(integer2); Console.WriteLine($"Subtract result: {result}"); // compare two BigNumbers Console.WriteLine($"BigNumber 1 is zero: {integer1.IsZero()}"); Console.WriteLine($"B.

namespace Habib_OLA4 { internal class Program { .pdf

1 of 6
Download to read offline
namespace Habib_OLA4
{
internal class Program
{
private int[] digits;
public BigNumber()
{
digits = new int[40];
}
public void Input(string input)
{
int startIndex = 0;
bool isNegative = false;
if (input[0] == '-')
{
isNegative = true;
startIndex = 1;
}
for (int i = 0; i < digits.Length; i++)
{
digits[i] = 0;
}
for (int i = startIndex; i < input.Length; i++)
{
digits[digits.Length - input.Length + i] = input[i] - '0';
}
if (isNegative)
{
Negate();
}
}
public override string ToString()
{
int startIndex = 0;
while (startIndex < digits.Length - 1 && digits[startIndex] == 0)
{
startIndex++;
}
if (digits[startIndex] < 0)
{
return "-" + new BigNumber(digits).ToString();
}
char[] chars = new char[digits.Length - startIndex];
for (int i = 0; i < chars.Length; i++)
{
chars[i] = (char)(digits[startIndex + i] + '0');
}
return new string(chars);
}
public BigNumber Add(BigNumber other)
{
BigNumber result = new BigNumber();
int carry = 0;
for (int i = digits.Length - 1; i >= 0; i--)
{
int sum = digits[i] + other.digits[i] + carry;
result.digits[i] = sum % 10;
carry = sum / 10;
}
return result;
}
public BigNumber Subtract(BigNumber other)
{
BigNumber result = new BigNumber();
int borrow = 0;
for (int i = digits.Length - 1; i >= 0; i--)
{
int difference = digits[i] - other.digits[i] - borrow;
if (difference < 0)
{
difference += 10;
borrow = 1;
}
else
{
borrow = 0;
}
result.digits[i] = difference;
}
return result;
}
public bool IsEqualTo(BigNumber other)
{
for (int i = 0; i < digits.Length; i++)
{
if (digits[i] != other.digits[i])
{
return false;
}
}
return true;
}
public bool IsNotEqualTo(BigNumber other)
{
return !IsEqualTo(other);
}
public bool IsGreaterThan(BigNumber other)
{
for (int i = 0; i < digits.Length; i++)
{
if (digits[i] > other.digits[i])
{
return true;
}
else if (digits[i] < other.digits[i])
{
return false;
}
}
return false;
}
public bool IsLessThan(BigNumber other)
{
for (int i = 0; i < digits.Length; i++)
{
if (digits[i] < other.digits[i])
{
return true;
}
else if (digits[i] > other.digits[i])
{
return false;
}
}
return false;
}
public bool IsGreaterThanOrEqualTo(BigNumber other)
{
for (int i = 0; i > digits.Length; i++)
{
if (digits[i] > other.digits[i])
{
return true;
}
else if (digits[i] < other.digits[i])
{
return false;
}
}
return false;
}
public static void Main(string[] args)
{
BigNumber integer1 = new BigNumber();
BigNumber integer2 = new BigNumber();
Console.Write("Enter first BigNumber: ");
integer1.Input(Console.ReadLine());
Console.Write("Enter second BigNumber: ");
integer2.Input(Console.ReadLine());
Console.WriteLine($"BigNumber 1: {integer1}");
Console.WriteLine($"BigNumber 2: {integer2}");
BigNumber result;
// add two BigNumbers
result = integer1.Add(integer2);
Console.WriteLine($"Add result: {result}");
// subtract two BigNumbers
result = integer1.Subtract(integer2);
Console.WriteLine($"Subtract result: {result}");
// compare two BigNumbers
Console.WriteLine($"BigNumber 1 is zero: {integer1.IsZero()}");
Console.WriteLine($"BigNumber 2 is zero: {integer2.IsZero()}");
Console.WriteLine($"BigNumber 1 is equal to BigNumber 2:
{integer1.IsEqualTo(integer2)}");
Console.WriteLine($"BigNumber 1 is not equal to BigNumber 2:
{integer1.IsNotEqualTo(integer2)}");
Console.WriteLine($"BigNumber 1 is greater than BigNumber 2:
{integer1.IsGreaterThan(integer2)}");
Console.WriteLine($"BigNumber 1 is less than BigNumber 2:
{integer1.IsLessThan(integer2)}");
Console.WriteLine($"BigNumber 1 is greater than or equal to BigNumber 2:
{integer1.IsGreaterThanOrEqualTo(integer2)}");
Console.WriteLine($"BigNumber 1 is less than or equal to BigNumber 2:
{integer1.IsLessThanOrEqualTo(integer2)}");
}
}
}
I have an error.
//This what the output support to look like
Sample Run 1:
Enter first BigNumber: 1234567890123456789012345678901234567890
Enter second BigNumber: 0987654321098765432109876543210987654321
BigNumber 1: 1234567890123456789012345678901234567890
BigNumber 2: 987654321098765432109876543210987654321
Add result: 2222222211222222221122222222112222222211
Subtract result: 246913569024691356902469135690246913569
BigNumber 1 is zero: False
BigNumber 2 is zero: False
BigNumber 1 is equal to BigNumber 2: False
BigNumber 1 is not equal to BigNumber 2: True
BigNumber 1 is greater than BigNumber 2: True
BigNumber 1 is less than BigNumber 2: False
BigNumber 1 is greater than or equal to BigNumber 2: True
BigNumber 1 is less than or equal to BigNumber 2: False
Press any key to continue . . .
Can you help me with the c# program?
Ad

Recommended

COA_remaining_lab_works_077BCT033.pdf
COA_remaining_lab_works_077BCT033.pdfCOA_remaining_lab_works_077BCT033.pdf
COA_remaining_lab_works_077BCT033.pdfJavedAnsari236392
 
Explain this code- please- Code public class Question8 { public stati.docx
Explain this code- please- Code public class Question8 {  public stati.docxExplain this code- please- Code public class Question8 {  public stati.docx
Explain this code- please- Code public class Question8 { public stati.docxjames876543264
 
I get this error on the C# code need help using System- namespace Proj.pdf
I get this error on the C# code need help using System- namespace Proj.pdfI get this error on the C# code need help using System- namespace Proj.pdf
I get this error on the C# code need help using System- namespace Proj.pdfshreeaadithyaacellso
 
import java.util.Scanner; class StallLogic { public void print.pdf
import java.util.Scanner; class StallLogic { public void print.pdfimport java.util.Scanner; class StallLogic { public void print.pdf
import java.util.Scanner; class StallLogic { public void print.pdfarccreation001
 
Questions has 4 parts.1st part Program to implement sorting algor.pdf
Questions has 4 parts.1st part Program to implement sorting algor.pdfQuestions has 4 parts.1st part Program to implement sorting algor.pdf
Questions has 4 parts.1st part Program to implement sorting algor.pdfapexelectronices01
 

More Related Content

Similar to namespace Habib_OLA4 { internal class Program { .pdf

Please help me make a UML for Java! Look at the code below and make a.docx
Please help me make a UML for Java! Look at the code below and make a.docxPlease help me make a UML for Java! Look at the code below and make a.docx
Please help me make a UML for Java! Look at the code below and make a.docxJakeT2gGrayp
 
Using the java code below- i need help in having my code output the fo.pdf
Using the java code below- i need help in having my code output the fo.pdfUsing the java code below- i need help in having my code output the fo.pdf
Using the java code below- i need help in having my code output the fo.pdfacteleshoppe
 
From clever code to better code
From clever code to better codeFrom clever code to better code
From clever code to better codeDror Helper
 
#include iostream #include string #include iomanip #incl.pdf
#include iostream #include string #include iomanip #incl.pdf#include iostream #include string #include iomanip #incl.pdf
#include iostream #include string #include iomanip #incl.pdfsudhinjv
 
What is the output of the code thanks- public class Sphere12 { public.pdf
What is the output of the code thanks- public class Sphere12 { public.pdfWhat is the output of the code thanks- public class Sphere12 { public.pdf
What is the output of the code thanks- public class Sphere12 { public.pdfsujeetdube007
 
This code is wrong I need some help with it all three files are there.docx
This code is wrong I need some help with it all three files are there.docxThis code is wrong I need some help with it all three files are there.docx
This code is wrong I need some help with it all three files are there.docxEricIPjGreenes
 
package com.app.test;import java.util.Scanner;public class Testp.pdf
package com.app.test;import java.util.Scanner;public class Testp.pdfpackage com.app.test;import java.util.Scanner;public class Testp.pdf
package com.app.test;import java.util.Scanner;public class Testp.pdfsanjeevtandonsre
 
ReadData.javaimport java.util.Scanner; public class ReadData {.pdf
ReadData.javaimport java.util.Scanner; public class ReadData {.pdfReadData.javaimport java.util.Scanner; public class ReadData {.pdf
ReadData.javaimport java.util.Scanner; public class ReadData {.pdfsinghanubhav1234
 
include ltstdiohgtinclude ltstdlibhgtinclude l.pdf
include ltstdiohgtinclude ltstdlibhgtinclude l.pdfinclude ltstdiohgtinclude ltstdlibhgtinclude l.pdf
include ltstdiohgtinclude ltstdlibhgtinclude l.pdfadisainternational
 
This code is wrong I need some help with it Instructions The following.docx
This code is wrong I need some help with it Instructions The following.docxThis code is wrong I need some help with it Instructions The following.docx
This code is wrong I need some help with it Instructions The following.docxEricIPjGreenes
 
2 BytesC++ course_2014_c4_ arrays
2 BytesC++ course_2014_c4_ arrays2 BytesC++ course_2014_c4_ arrays
2 BytesC++ course_2014_c4_ arrayskinan keshkeh
 
import java.util.; public class DecimalToBinary { public stat.pdf
import java.util.; public class DecimalToBinary { public stat.pdfimport java.util.; public class DecimalToBinary { public stat.pdf
import java.util.; public class DecimalToBinary { public stat.pdfanithareadymade
 
Please use Netbeans Write a program that teals the integers betwe.pdf
Please use Netbeans Write a program that teals the integers betwe.pdfPlease use Netbeans Write a program that teals the integers betwe.pdf
Please use Netbeans Write a program that teals the integers betwe.pdfmontybachawat
 

Similar to namespace Habib_OLA4 { internal class Program { .pdf (20)

Please help me make a UML for Java! Look at the code below and make a.docx
Please help me make a UML for Java! Look at the code below and make a.docxPlease help me make a UML for Java! Look at the code below and make a.docx
Please help me make a UML for Java! Look at the code below and make a.docx
 
types.pdf
types.pdftypes.pdf
types.pdf
 
Using the java code below- i need help in having my code output the fo.pdf
Using the java code below- i need help in having my code output the fo.pdfUsing the java code below- i need help in having my code output the fo.pdf
Using the java code below- i need help in having my code output the fo.pdf
 
From clever code to better code
From clever code to better codeFrom clever code to better code
From clever code to better code
 
Cpp c++ 1
Cpp c++ 1Cpp c++ 1
Cpp c++ 1
 
#include iostream #include string #include iomanip #incl.pdf
#include iostream #include string #include iomanip #incl.pdf#include iostream #include string #include iomanip #incl.pdf
#include iostream #include string #include iomanip #incl.pdf
 
What is the output of the code thanks- public class Sphere12 { public.pdf
What is the output of the code thanks- public class Sphere12 { public.pdfWhat is the output of the code thanks- public class Sphere12 { public.pdf
What is the output of the code thanks- public class Sphere12 { public.pdf
 
C programs
C programsC programs
C programs
 
This code is wrong I need some help with it all three files are there.docx
This code is wrong I need some help with it all three files are there.docxThis code is wrong I need some help with it all three files are there.docx
This code is wrong I need some help with it all three files are there.docx
 
package com.app.test;import java.util.Scanner;public class Testp.pdf
package com.app.test;import java.util.Scanner;public class Testp.pdfpackage com.app.test;import java.util.Scanner;public class Testp.pdf
package com.app.test;import java.util.Scanner;public class Testp.pdf
 
ReadData.javaimport java.util.Scanner; public class ReadData {.pdf
ReadData.javaimport java.util.Scanner; public class ReadData {.pdfReadData.javaimport java.util.Scanner; public class ReadData {.pdf
ReadData.javaimport java.util.Scanner; public class ReadData {.pdf
 
include ltstdiohgtinclude ltstdlibhgtinclude l.pdf
include ltstdiohgtinclude ltstdlibhgtinclude l.pdfinclude ltstdiohgtinclude ltstdlibhgtinclude l.pdf
include ltstdiohgtinclude ltstdlibhgtinclude l.pdf
 
This code is wrong I need some help with it Instructions The following.docx
This code is wrong I need some help with it Instructions The following.docxThis code is wrong I need some help with it Instructions The following.docx
This code is wrong I need some help with it Instructions The following.docx
 
2 BytesC++ course_2014_c4_ arrays
2 BytesC++ course_2014_c4_ arrays2 BytesC++ course_2014_c4_ arrays
2 BytesC++ course_2014_c4_ arrays
 
cosc 281 hw2
cosc 281 hw2cosc 281 hw2
cosc 281 hw2
 
Codejunk Ignitesd
Codejunk IgnitesdCodejunk Ignitesd
Codejunk Ignitesd
 
Lab Question
Lab QuestionLab Question
Lab Question
 
import java.util.; public class DecimalToBinary { public stat.pdf
import java.util.; public class DecimalToBinary { public stat.pdfimport java.util.; public class DecimalToBinary { public stat.pdf
import java.util.; public class DecimalToBinary { public stat.pdf
 
Code
CodeCode
Code
 
Please use Netbeans Write a program that teals the integers betwe.pdf
Please use Netbeans Write a program that teals the integers betwe.pdfPlease use Netbeans Write a program that teals the integers betwe.pdf
Please use Netbeans Write a program that teals the integers betwe.pdf
 

More from amazonedistributors

Need help debugging this assignmentimport java.util.;public c.pdf
Need help debugging this assignmentimport java.util.;public c.pdfNeed help debugging this assignmentimport java.util.;public c.pdf
Need help debugging this assignmentimport java.util.;public c.pdfamazonedistributors
 
NECESITO TODAS LAS RESPUESTAS CORRECTAS1. Tom quer�a crear un me.pdf
NECESITO TODAS LAS RESPUESTAS CORRECTAS1. Tom quer�a crear un me.pdfNECESITO TODAS LAS RESPUESTAS CORRECTAS1. Tom quer�a crear un me.pdf
NECESITO TODAS LAS RESPUESTAS CORRECTAS1. Tom quer�a crear un me.pdfamazonedistributors
 
Need answers for the four questions at the end of case. When Micro.pdf
Need answers for the four questions at the end of case. When Micro.pdfNeed answers for the four questions at the end of case. When Micro.pdf
Need answers for the four questions at the end of case. When Micro.pdfamazonedistributors
 
Necesito ayuda con todas estas preguntas.1-Enumera algunas similit.pdf
Necesito ayuda con todas estas preguntas.1-Enumera algunas similit.pdfNecesito ayuda con todas estas preguntas.1-Enumera algunas similit.pdf
Necesito ayuda con todas estas preguntas.1-Enumera algunas similit.pdfamazonedistributors
 
Necesita ayuda con estas preguntas de bioqu�mica por favorPregunt.pdf
Necesita ayuda con estas preguntas de bioqu�mica por favorPregunt.pdfNecesita ayuda con estas preguntas de bioqu�mica por favorPregunt.pdf
Necesita ayuda con estas preguntas de bioqu�mica por favorPregunt.pdfamazonedistributors
 
n this exercise, you modify the Check Digit application from this ch.pdf
n this exercise, you modify the Check Digit application from this ch.pdfn this exercise, you modify the Check Digit application from this ch.pdf
n this exercise, you modify the Check Digit application from this ch.pdfamazonedistributors
 
NavCom vende sistemas GPS a un fabricante de autom�viles. �C�mo pued.pdf
NavCom vende sistemas GPS a un fabricante de autom�viles. �C�mo pued.pdfNavCom vende sistemas GPS a un fabricante de autom�viles. �C�mo pued.pdf
NavCom vende sistemas GPS a un fabricante de autom�viles. �C�mo pued.pdfamazonedistributors
 
Name the 4 conditions for regression analysis and give evidence on w.pdf
Name the 4 conditions for regression analysis and give evidence on w.pdfName the 4 conditions for regression analysis and give evidence on w.pdf
Name the 4 conditions for regression analysis and give evidence on w.pdfamazonedistributors
 
namespace Habib_OLA4 { internal class Program { .pdf
namespace Habib_OLA4 {     internal class Program     {     .pdfnamespace Habib_OLA4 {     internal class Program     {     .pdf
namespace Habib_OLA4 { internal class Program { .pdfamazonedistributors
 
Nancy is carrying out cost-benefit analysis for a project. If undert.pdf
Nancy is carrying out cost-benefit analysis for a project. If undert.pdfNancy is carrying out cost-benefit analysis for a project. If undert.pdf
Nancy is carrying out cost-benefit analysis for a project. If undert.pdfamazonedistributors
 
Necesito ayuda con un cuestionario, s� que la regla de Chegg es publ.pdf
Necesito ayuda con un cuestionario, s� que la regla de Chegg es publ.pdfNecesito ayuda con un cuestionario, s� que la regla de Chegg es publ.pdf
Necesito ayuda con un cuestionario, s� que la regla de Chegg es publ.pdfamazonedistributors
 
n2=25n1=12x=115y=107ay=20oy=11 The confdence mbervai is (Fiound to two.pdf
n2=25n1=12x=115y=107ay=20oy=11 The confdence mbervai is (Fiound to two.pdfn2=25n1=12x=115y=107ay=20oy=11 The confdence mbervai is (Fiound to two.pdf
n2=25n1=12x=115y=107ay=20oy=11 The confdence mbervai is (Fiound to two.pdfamazonedistributors
 
Narrative 2 Cornick, Inc.Cornick, Inc. sells office products to b.pdf
Narrative 2 Cornick, Inc.Cornick, Inc. sells office products to b.pdfNarrative 2 Cornick, Inc.Cornick, Inc. sells office products to b.pdf
Narrative 2 Cornick, Inc.Cornick, Inc. sells office products to b.pdfamazonedistributors
 
Narcisco Publications established the following standard price and c.pdf
Narcisco Publications established the following standard price and c.pdfNarcisco Publications established the following standard price and c.pdf
Narcisco Publications established the following standard price and c.pdfamazonedistributors
 
not sure what the equations isy^=60.5+2.50x.pdf
not sure what the equations isy^=60.5+2.50x.pdfnot sure what the equations isy^=60.5+2.50x.pdf
not sure what the equations isy^=60.5+2.50x.pdfamazonedistributors
 
No plagiarism and at least 250 wordsBriefly describe the dif.pdf
No plagiarism and at least 250 wordsBriefly describe the dif.pdfNo plagiarism and at least 250 wordsBriefly describe the dif.pdf
No plagiarism and at least 250 wordsBriefly describe the dif.pdfamazonedistributors
 
NOTE CODE MUST BE IN ASSEMBLY LANGUAGE (10 points) 3. Write a progr.pdf
NOTE CODE MUST BE IN ASSEMBLY LANGUAGE (10 points) 3. Write a progr.pdfNOTE CODE MUST BE IN ASSEMBLY LANGUAGE (10 points) 3. Write a progr.pdf
NOTE CODE MUST BE IN ASSEMBLY LANGUAGE (10 points) 3. Write a progr.pdfamazonedistributors
 
not taxable and any related input tax is therefore not deductible. T.pdf
not taxable and any related input tax is therefore not deductible. T.pdfnot taxable and any related input tax is therefore not deductible. T.pdf
not taxable and any related input tax is therefore not deductible. T.pdfamazonedistributors
 
Normal Distribution Problem. Porphyrin is a pigment in blood proto.pdf
Normal Distribution Problem.   Porphyrin is a pigment in blood proto.pdfNormal Distribution Problem.   Porphyrin is a pigment in blood proto.pdf
Normal Distribution Problem. Porphyrin is a pigment in blood proto.pdfamazonedistributors
 
Non-liquidating DistributionsCorporation is a calendar year taxpay.pdf
Non-liquidating DistributionsCorporation is a calendar year taxpay.pdfNon-liquidating DistributionsCorporation is a calendar year taxpay.pdf
Non-liquidating DistributionsCorporation is a calendar year taxpay.pdfamazonedistributors
 

More from amazonedistributors (20)

Need help debugging this assignmentimport java.util.;public c.pdf
Need help debugging this assignmentimport java.util.;public c.pdfNeed help debugging this assignmentimport java.util.;public c.pdf
Need help debugging this assignmentimport java.util.;public c.pdf
 
NECESITO TODAS LAS RESPUESTAS CORRECTAS1. Tom quer�a crear un me.pdf
NECESITO TODAS LAS RESPUESTAS CORRECTAS1. Tom quer�a crear un me.pdfNECESITO TODAS LAS RESPUESTAS CORRECTAS1. Tom quer�a crear un me.pdf
NECESITO TODAS LAS RESPUESTAS CORRECTAS1. Tom quer�a crear un me.pdf
 
Need answers for the four questions at the end of case. When Micro.pdf
Need answers for the four questions at the end of case. When Micro.pdfNeed answers for the four questions at the end of case. When Micro.pdf
Need answers for the four questions at the end of case. When Micro.pdf
 
Necesito ayuda con todas estas preguntas.1-Enumera algunas similit.pdf
Necesito ayuda con todas estas preguntas.1-Enumera algunas similit.pdfNecesito ayuda con todas estas preguntas.1-Enumera algunas similit.pdf
Necesito ayuda con todas estas preguntas.1-Enumera algunas similit.pdf
 
Necesita ayuda con estas preguntas de bioqu�mica por favorPregunt.pdf
Necesita ayuda con estas preguntas de bioqu�mica por favorPregunt.pdfNecesita ayuda con estas preguntas de bioqu�mica por favorPregunt.pdf
Necesita ayuda con estas preguntas de bioqu�mica por favorPregunt.pdf
 
n this exercise, you modify the Check Digit application from this ch.pdf
n this exercise, you modify the Check Digit application from this ch.pdfn this exercise, you modify the Check Digit application from this ch.pdf
n this exercise, you modify the Check Digit application from this ch.pdf
 
NavCom vende sistemas GPS a un fabricante de autom�viles. �C�mo pued.pdf
NavCom vende sistemas GPS a un fabricante de autom�viles. �C�mo pued.pdfNavCom vende sistemas GPS a un fabricante de autom�viles. �C�mo pued.pdf
NavCom vende sistemas GPS a un fabricante de autom�viles. �C�mo pued.pdf
 
Name the 4 conditions for regression analysis and give evidence on w.pdf
Name the 4 conditions for regression analysis and give evidence on w.pdfName the 4 conditions for regression analysis and give evidence on w.pdf
Name the 4 conditions for regression analysis and give evidence on w.pdf
 
namespace Habib_OLA4 { internal class Program { .pdf
namespace Habib_OLA4 {     internal class Program     {     .pdfnamespace Habib_OLA4 {     internal class Program     {     .pdf
namespace Habib_OLA4 { internal class Program { .pdf
 
Nancy is carrying out cost-benefit analysis for a project. If undert.pdf
Nancy is carrying out cost-benefit analysis for a project. If undert.pdfNancy is carrying out cost-benefit analysis for a project. If undert.pdf
Nancy is carrying out cost-benefit analysis for a project. If undert.pdf
 
Necesito ayuda con un cuestionario, s� que la regla de Chegg es publ.pdf
Necesito ayuda con un cuestionario, s� que la regla de Chegg es publ.pdfNecesito ayuda con un cuestionario, s� que la regla de Chegg es publ.pdf
Necesito ayuda con un cuestionario, s� que la regla de Chegg es publ.pdf
 
n2=25n1=12x=115y=107ay=20oy=11 The confdence mbervai is (Fiound to two.pdf
n2=25n1=12x=115y=107ay=20oy=11 The confdence mbervai is (Fiound to two.pdfn2=25n1=12x=115y=107ay=20oy=11 The confdence mbervai is (Fiound to two.pdf
n2=25n1=12x=115y=107ay=20oy=11 The confdence mbervai is (Fiound to two.pdf
 
Narrative 2 Cornick, Inc.Cornick, Inc. sells office products to b.pdf
Narrative 2 Cornick, Inc.Cornick, Inc. sells office products to b.pdfNarrative 2 Cornick, Inc.Cornick, Inc. sells office products to b.pdf
Narrative 2 Cornick, Inc.Cornick, Inc. sells office products to b.pdf
 
Narcisco Publications established the following standard price and c.pdf
Narcisco Publications established the following standard price and c.pdfNarcisco Publications established the following standard price and c.pdf
Narcisco Publications established the following standard price and c.pdf
 
not sure what the equations isy^=60.5+2.50x.pdf
not sure what the equations isy^=60.5+2.50x.pdfnot sure what the equations isy^=60.5+2.50x.pdf
not sure what the equations isy^=60.5+2.50x.pdf
 
No plagiarism and at least 250 wordsBriefly describe the dif.pdf
No plagiarism and at least 250 wordsBriefly describe the dif.pdfNo plagiarism and at least 250 wordsBriefly describe the dif.pdf
No plagiarism and at least 250 wordsBriefly describe the dif.pdf
 
NOTE CODE MUST BE IN ASSEMBLY LANGUAGE (10 points) 3. Write a progr.pdf
NOTE CODE MUST BE IN ASSEMBLY LANGUAGE (10 points) 3. Write a progr.pdfNOTE CODE MUST BE IN ASSEMBLY LANGUAGE (10 points) 3. Write a progr.pdf
NOTE CODE MUST BE IN ASSEMBLY LANGUAGE (10 points) 3. Write a progr.pdf
 
not taxable and any related input tax is therefore not deductible. T.pdf
not taxable and any related input tax is therefore not deductible. T.pdfnot taxable and any related input tax is therefore not deductible. T.pdf
not taxable and any related input tax is therefore not deductible. T.pdf
 
Normal Distribution Problem. Porphyrin is a pigment in blood proto.pdf
Normal Distribution Problem.   Porphyrin is a pigment in blood proto.pdfNormal Distribution Problem.   Porphyrin is a pigment in blood proto.pdf
Normal Distribution Problem. Porphyrin is a pigment in blood proto.pdf
 
Non-liquidating DistributionsCorporation is a calendar year taxpay.pdf
Non-liquidating DistributionsCorporation is a calendar year taxpay.pdfNon-liquidating DistributionsCorporation is a calendar year taxpay.pdf
Non-liquidating DistributionsCorporation is a calendar year taxpay.pdf
 

Recently uploaded

Evaluation and management of patients with Dyspepsia.pptx
Evaluation and management of patients with Dyspepsia.pptxEvaluation and management of patients with Dyspepsia.pptx
Evaluation and management of patients with Dyspepsia.pptxgarvitnanecha
 
catch-up-friday-ARALING PNLIPUNAN SOCIAL JUSTICE AND HUMAN RIGHTS
catch-up-friday-ARALING PNLIPUNAN SOCIAL JUSTICE AND HUMAN RIGHTScatch-up-friday-ARALING PNLIPUNAN SOCIAL JUSTICE AND HUMAN RIGHTS
catch-up-friday-ARALING PNLIPUNAN SOCIAL JUSTICE AND HUMAN RIGHTSCarlaNicolas7
 
EDL 290F Week 1 - Meet Me at the Start Line.pdf
EDL 290F Week 1 - Meet Me at the Start Line.pdfEDL 290F Week 1 - Meet Me at the Start Line.pdf
EDL 290F Week 1 - Meet Me at the Start Line.pdfElizabeth Walsh
 
CapTechTalks Webinar Feb 2024 Darrell Burrell.pptx
CapTechTalks Webinar Feb 2024 Darrell Burrell.pptxCapTechTalks Webinar Feb 2024 Darrell Burrell.pptx
CapTechTalks Webinar Feb 2024 Darrell Burrell.pptxCapitolTechU
 
Intuition behind Monte Carlo Markov Chains
Intuition behind Monte Carlo Markov ChainsIntuition behind Monte Carlo Markov Chains
Intuition behind Monte Carlo Markov ChainsTushar Tank
 
Food Web SlideShare for Ecology Notes Quiz in Canvas
Food Web SlideShare for Ecology Notes Quiz in CanvasFood Web SlideShare for Ecology Notes Quiz in Canvas
Food Web SlideShare for Ecology Notes Quiz in CanvasAlexandraSwartzwelde
 
UniSC Moreton Bay Library self-guided tour
UniSC Moreton Bay Library self-guided tourUniSC Moreton Bay Library self-guided tour
UniSC Moreton Bay Library self-guided tourUSC_Library
 
Writing Agony Letter & If type O+1 & Diphthongs + Text “Arab Science”.pdf
Writing Agony Letter & If type O+1 & Diphthongs + Text “Arab Science”.pdfWriting Agony Letter & If type O+1 & Diphthongs + Text “Arab Science”.pdf
Writing Agony Letter & If type O+1 & Diphthongs + Text “Arab Science”.pdfMr Bounab Samir
 
IR introduction Introduction, Principle & Theory
IR introduction Introduction, Principle & TheoryIR introduction Introduction, Principle & Theory
IR introduction Introduction, Principle & Theorynivedithag131
 
DISCOURSE: TEXT AS CONNECTED DISCOURSE
DISCOURSE:   TEXT AS CONNECTED DISCOURSEDISCOURSE:   TEXT AS CONNECTED DISCOURSE
DISCOURSE: TEXT AS CONNECTED DISCOURSEMYDA ANGELICA SUAN
 
Exit Essay - Save the Filipino Language by Renz Perez.docx
Exit Essay - Save the Filipino Language by Renz Perez.docxExit Essay - Save the Filipino Language by Renz Perez.docx
Exit Essay - Save the Filipino Language by Renz Perez.docxMYDA ANGELICA SUAN
 
Bayesian Analysis Fundamentals with Examples
Bayesian Analysis Fundamentals with ExamplesBayesian Analysis Fundamentals with Examples
Bayesian Analysis Fundamentals with ExamplesTushar Tank
 
CONCEPTS OF ENVIRONMENT & ECOSYSTEM.pptx
CONCEPTS OF ENVIRONMENT & ECOSYSTEM.pptxCONCEPTS OF ENVIRONMENT & ECOSYSTEM.pptx
CONCEPTS OF ENVIRONMENT & ECOSYSTEM.pptxAnupkumar Sharma
 
Data Modeling - Entity Relationship Diagrams-1.pdf
Data Modeling - Entity Relationship Diagrams-1.pdfData Modeling - Entity Relationship Diagrams-1.pdf
Data Modeling - Entity Relationship Diagrams-1.pdfChristalin Nelson
 
Overview of Databases and Data Modelling-2.pdf
Overview of Databases and Data Modelling-2.pdfOverview of Databases and Data Modelling-2.pdf
Overview of Databases and Data Modelling-2.pdfChristalin Nelson
 
Overview of Databases and Data Modelling-1.pdf
Overview of Databases and Data Modelling-1.pdfOverview of Databases and Data Modelling-1.pdf
Overview of Databases and Data Modelling-1.pdfChristalin Nelson
 
skeletal system details with joints and its types
skeletal system details with joints and its typesskeletal system details with joints and its types
skeletal system details with joints and its typesMinaxi patil. CATALLYST
 
LIPIDS UNIT ONE BIOMOLECULE PRESENTATION
LIPIDS UNIT ONE BIOMOLECULE PRESENTATIONLIPIDS UNIT ONE BIOMOLECULE PRESENTATION
LIPIDS UNIT ONE BIOMOLECULE PRESENTATIONSayali Powar
 
UNIT 1 BIOMOLECULE_CARBOHYDRATES PRESENTATION
UNIT 1 BIOMOLECULE_CARBOHYDRATES PRESENTATIONUNIT 1 BIOMOLECULE_CARBOHYDRATES PRESENTATION
UNIT 1 BIOMOLECULE_CARBOHYDRATES PRESENTATIONSayali Powar
 

Recently uploaded (20)

Evaluation and management of patients with Dyspepsia.pptx
Evaluation and management of patients with Dyspepsia.pptxEvaluation and management of patients with Dyspepsia.pptx
Evaluation and management of patients with Dyspepsia.pptx
 
catch-up-friday-ARALING PNLIPUNAN SOCIAL JUSTICE AND HUMAN RIGHTS
catch-up-friday-ARALING PNLIPUNAN SOCIAL JUSTICE AND HUMAN RIGHTScatch-up-friday-ARALING PNLIPUNAN SOCIAL JUSTICE AND HUMAN RIGHTS
catch-up-friday-ARALING PNLIPUNAN SOCIAL JUSTICE AND HUMAN RIGHTS
 
EDL 290F Week 1 - Meet Me at the Start Line.pdf
EDL 290F Week 1 - Meet Me at the Start Line.pdfEDL 290F Week 1 - Meet Me at the Start Line.pdf
EDL 290F Week 1 - Meet Me at the Start Line.pdf
 
CapTechTalks Webinar Feb 2024 Darrell Burrell.pptx
CapTechTalks Webinar Feb 2024 Darrell Burrell.pptxCapTechTalks Webinar Feb 2024 Darrell Burrell.pptx
CapTechTalks Webinar Feb 2024 Darrell Burrell.pptx
 
first section physiology laboratory.pptx
first section physiology laboratory.pptxfirst section physiology laboratory.pptx
first section physiology laboratory.pptx
 
Intuition behind Monte Carlo Markov Chains
Intuition behind Monte Carlo Markov ChainsIntuition behind Monte Carlo Markov Chains
Intuition behind Monte Carlo Markov Chains
 
Food Web SlideShare for Ecology Notes Quiz in Canvas
Food Web SlideShare for Ecology Notes Quiz in CanvasFood Web SlideShare for Ecology Notes Quiz in Canvas
Food Web SlideShare for Ecology Notes Quiz in Canvas
 
UniSC Moreton Bay Library self-guided tour
UniSC Moreton Bay Library self-guided tourUniSC Moreton Bay Library self-guided tour
UniSC Moreton Bay Library self-guided tour
 
Writing Agony Letter & If type O+1 & Diphthongs + Text “Arab Science”.pdf
Writing Agony Letter & If type O+1 & Diphthongs + Text “Arab Science”.pdfWriting Agony Letter & If type O+1 & Diphthongs + Text “Arab Science”.pdf
Writing Agony Letter & If type O+1 & Diphthongs + Text “Arab Science”.pdf
 
IR introduction Introduction, Principle & Theory
IR introduction Introduction, Principle & TheoryIR introduction Introduction, Principle & Theory
IR introduction Introduction, Principle & Theory
 
DISCOURSE: TEXT AS CONNECTED DISCOURSE
DISCOURSE:   TEXT AS CONNECTED DISCOURSEDISCOURSE:   TEXT AS CONNECTED DISCOURSE
DISCOURSE: TEXT AS CONNECTED DISCOURSE
 
Exit Essay - Save the Filipino Language by Renz Perez.docx
Exit Essay - Save the Filipino Language by Renz Perez.docxExit Essay - Save the Filipino Language by Renz Perez.docx
Exit Essay - Save the Filipino Language by Renz Perez.docx
 
Bayesian Analysis Fundamentals with Examples
Bayesian Analysis Fundamentals with ExamplesBayesian Analysis Fundamentals with Examples
Bayesian Analysis Fundamentals with Examples
 
CONCEPTS OF ENVIRONMENT & ECOSYSTEM.pptx
CONCEPTS OF ENVIRONMENT & ECOSYSTEM.pptxCONCEPTS OF ENVIRONMENT & ECOSYSTEM.pptx
CONCEPTS OF ENVIRONMENT & ECOSYSTEM.pptx
 
Data Modeling - Entity Relationship Diagrams-1.pdf
Data Modeling - Entity Relationship Diagrams-1.pdfData Modeling - Entity Relationship Diagrams-1.pdf
Data Modeling - Entity Relationship Diagrams-1.pdf
 
Overview of Databases and Data Modelling-2.pdf
Overview of Databases and Data Modelling-2.pdfOverview of Databases and Data Modelling-2.pdf
Overview of Databases and Data Modelling-2.pdf
 
Overview of Databases and Data Modelling-1.pdf
Overview of Databases and Data Modelling-1.pdfOverview of Databases and Data Modelling-1.pdf
Overview of Databases and Data Modelling-1.pdf
 
skeletal system details with joints and its types
skeletal system details with joints and its typesskeletal system details with joints and its types
skeletal system details with joints and its types
 
LIPIDS UNIT ONE BIOMOLECULE PRESENTATION
LIPIDS UNIT ONE BIOMOLECULE PRESENTATIONLIPIDS UNIT ONE BIOMOLECULE PRESENTATION
LIPIDS UNIT ONE BIOMOLECULE PRESENTATION
 
UNIT 1 BIOMOLECULE_CARBOHYDRATES PRESENTATION
UNIT 1 BIOMOLECULE_CARBOHYDRATES PRESENTATIONUNIT 1 BIOMOLECULE_CARBOHYDRATES PRESENTATION
UNIT 1 BIOMOLECULE_CARBOHYDRATES PRESENTATION
 

namespace Habib_OLA4 { internal class Program { .pdf

  • 1. namespace Habib_OLA4 { internal class Program { private int[] digits; public BigNumber() { digits = new int[40]; } public void Input(string input) { int startIndex = 0; bool isNegative = false; if (input[0] == '-') { isNegative = true; startIndex = 1; } for (int i = 0; i < digits.Length; i++) { digits[i] = 0; } for (int i = startIndex; i < input.Length; i++) { digits[digits.Length - input.Length + i] = input[i] - '0'; } if (isNegative) { Negate(); } } public override string ToString() { int startIndex = 0; while (startIndex < digits.Length - 1 && digits[startIndex] == 0)
  • 2. { startIndex++; } if (digits[startIndex] < 0) { return "-" + new BigNumber(digits).ToString(); } char[] chars = new char[digits.Length - startIndex]; for (int i = 0; i < chars.Length; i++) { chars[i] = (char)(digits[startIndex + i] + '0'); } return new string(chars); } public BigNumber Add(BigNumber other) { BigNumber result = new BigNumber(); int carry = 0; for (int i = digits.Length - 1; i >= 0; i--) { int sum = digits[i] + other.digits[i] + carry; result.digits[i] = sum % 10; carry = sum / 10; } return result; } public BigNumber Subtract(BigNumber other) { BigNumber result = new BigNumber(); int borrow = 0; for (int i = digits.Length - 1; i >= 0; i--) { int difference = digits[i] - other.digits[i] - borrow; if (difference < 0) { difference += 10;
  • 3. borrow = 1; } else { borrow = 0; } result.digits[i] = difference; } return result; } public bool IsEqualTo(BigNumber other) { for (int i = 0; i < digits.Length; i++) { if (digits[i] != other.digits[i]) { return false; } } return true; } public bool IsNotEqualTo(BigNumber other) { return !IsEqualTo(other); } public bool IsGreaterThan(BigNumber other) { for (int i = 0; i < digits.Length; i++) { if (digits[i] > other.digits[i]) { return true; } else if (digits[i] < other.digits[i]) { return false;
  • 4. } } return false; } public bool IsLessThan(BigNumber other) { for (int i = 0; i < digits.Length; i++) { if (digits[i] < other.digits[i]) { return true; } else if (digits[i] > other.digits[i]) { return false; } } return false; } public bool IsGreaterThanOrEqualTo(BigNumber other) { for (int i = 0; i > digits.Length; i++) { if (digits[i] > other.digits[i]) { return true; } else if (digits[i] < other.digits[i]) { return false; } } return false; } public static void Main(string[] args) {
  • 5. BigNumber integer1 = new BigNumber(); BigNumber integer2 = new BigNumber(); Console.Write("Enter first BigNumber: "); integer1.Input(Console.ReadLine()); Console.Write("Enter second BigNumber: "); integer2.Input(Console.ReadLine()); Console.WriteLine($"BigNumber 1: {integer1}"); Console.WriteLine($"BigNumber 2: {integer2}"); BigNumber result; // add two BigNumbers result = integer1.Add(integer2); Console.WriteLine($"Add result: {result}"); // subtract two BigNumbers result = integer1.Subtract(integer2); Console.WriteLine($"Subtract result: {result}"); // compare two BigNumbers Console.WriteLine($"BigNumber 1 is zero: {integer1.IsZero()}"); Console.WriteLine($"BigNumber 2 is zero: {integer2.IsZero()}"); Console.WriteLine($"BigNumber 1 is equal to BigNumber 2: {integer1.IsEqualTo(integer2)}"); Console.WriteLine($"BigNumber 1 is not equal to BigNumber 2: {integer1.IsNotEqualTo(integer2)}"); Console.WriteLine($"BigNumber 1 is greater than BigNumber 2: {integer1.IsGreaterThan(integer2)}"); Console.WriteLine($"BigNumber 1 is less than BigNumber 2: {integer1.IsLessThan(integer2)}"); Console.WriteLine($"BigNumber 1 is greater than or equal to BigNumber 2: {integer1.IsGreaterThanOrEqualTo(integer2)}"); Console.WriteLine($"BigNumber 1 is less than or equal to BigNumber 2: {integer1.IsLessThanOrEqualTo(integer2)}"); } } } I have an error.
  • 6. //This what the output support to look like Sample Run 1: Enter first BigNumber: 1234567890123456789012345678901234567890 Enter second BigNumber: 0987654321098765432109876543210987654321 BigNumber 1: 1234567890123456789012345678901234567890 BigNumber 2: 987654321098765432109876543210987654321 Add result: 2222222211222222221122222222112222222211 Subtract result: 246913569024691356902469135690246913569 BigNumber 1 is zero: False BigNumber 2 is zero: False BigNumber 1 is equal to BigNumber 2: False BigNumber 1 is not equal to BigNumber 2: True BigNumber 1 is greater than BigNumber 2: True BigNumber 1 is less than BigNumber 2: False BigNumber 1 is greater than or equal to BigNumber 2: True BigNumber 1 is less than or equal to BigNumber 2: False Press any key to continue . . . Can you help me with the c# program?