Need Help With These 2 HW Questions.

// Question 2: Design a C# program that prompts the result (ans) of the following expression.

double v1 = 45.7;
double v2 = 10.5;
int v3 = 5;

// v1 += v1++;
// --v2;

double ans1;
ans1 = (int)v1 + v2 / (double)v3;
Console.WriteLine(ans1);

// Question 3.1: Design a C# program that prompts the result (ans) of the following expression.

double v1 = 45.7;
double v2 = 10.5;
int v3 = 5;

// v1 += v1++;

int ans2;
ans2 = (int)v1 + --v2 / (double)v3++;
Console.WriteLine(ans2);
Screenshot_2024-02-20_at_7.22.36_PM.png
Screenshot_2024-02-20_at_7.22.43_PM.png
Was this page helpful?