Question
i need some help tranlating this program from Java to C#(Ubuntu) public class Lab3{ public static void main(String[] args){ int A[] = {1,2,3,4}; int B[]
i need some help tranlating this program from Java to C#(Ubuntu)
public class Lab3{ public static void main(String[] args){
int A[] = {1,2,3,4}; int B[] = {5,6,7}; int C[] = {8,9,10,11}; int count = 0;
System.out.println("A= {1,2,3,4}, B={5,6,7} C={8,9,10,11} ");
System.out.println("Form the function f and g ");
System.out.println("f: A -> B");
for (int i = 0; i < A.length; i++){ for (int j = 0; j < 1; j++){ System.out.printf("(%d, %d) ", A[i], B[j]); if (i >= 1){ B[j]++; } } }
for (int j = 0; j < 3; j++){ B[j] -= 3; }
System.out.println(" g: B -> C");
for (int i = 0; i < C.length; i++){ for (int j = 0; j < 1; j++){ System.out.printf("(%d, %d) ", B[j], C[i]); if (i >= 1){ B[j]++; } } }
System.out.println(" Find gof ");
for(int i = 0; i < 1; i++){ B[i] -= 3; }
for(int i = 0; i < A.length; i++){ count++; for (int j = 0; j < 1; j++){ System.out.println("(gof)" + "(" + count + ") = " + "g(f" + "(" + A[i] + ")) = " + "g" + "(" + (B[j]) + ") = " + C[i]); if (i >= 1){ B[j]++; } if (i >= 1){ C[i]++; } } }
System.out.println(" gof");
for (int i = 0; i < A.length; i++){ for (int j = 0; j < 1; j++){ System.out.printf("(%d, %d) ", A[i], C[j]); C[j]++; } }
for (int i = 0; i < 1; i++){ C[i] -= 3; } for (int i = 0; i < 1; i++){ count -= 4; } for (int i = 0; i < 1; i++){ B[i] -=3; }
System.out.println(" Find fog ");
for(int i = 0; i < C.length; i++){ count++; C[i]--; for (int j = 0; j < 1; j++){ System.out.println("(fog)" + "(" + count + ") = " + "f(g" + "(" + C[i] + ")) = " + "g" + "(" + (B[j]) + ") = " + A[i]); A[i]++; if (i >= 1){ B[j]++; } if (i >1){ C[i]++; } } }
for (int i = 0; i < A.length; i++){ for (int j = 0; j < 1; j++){ if (i == 0){ System.out.println(" fog"); } A[i]--; System.out.printf("(%d, %d) ", C[j], A[i]); C[j]++; } } } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started