Answer:
#include <iostream>
#include <iomanip>
using namespace std;
int main() {
char choice;
cout << setprecision(12) << endl;
while(true) {
int sign = 1;
double pi = 0;
cout << "Enter number of terms: ";
long n;
cin >> n;
for(long i = 1; i < n; i += 2) {
pi += sign/(double)i;
sign = -sign;
}
pi *= 4;
cout << "value of pi for n = " << n << " is " << pi << endl;
cout << "Do you want to try again(y or n)? ";
cin >> choice;
if(choice == 'n' || choice == 'N') {
break;
}
}
return 0;
}
Explanation:
Answer:
Output: The question segment gives the following output--
1) 6
2) 5
3) JAVA!
4) i love
5) I LOVEjava!
Explanation:
- "1) 6" comes because "6" is the length of "I LOVE" which is the value of "x" variable and "x.length( )" statement gives the length of the value of "x" variable which is stored on "a" variable and "a" will be printed with "1)" symbol.
- "2) 5" comes because "5" is the length of "java!" which is the value of "y" variable and "y.length( )" statement gives the length of the value of "y" variable which is stored on "b" variable and "b" will be printed with "2)" symbol.
- "3) JAVA! " comes because "JAVA!" is the upper case letter of "java!" which is the value of "y" variable and "y.toUpperCase( )" statement change the value from lower case to uppercase of the value of "y" variable which is stored on "c" variable and "c" will be printed with "3)" symbol.
- "4) i love " comes because "i love" is the lower case letter of "I LOVE" which is the value of "x" variable and "x.toLowerCase( )" statement change the value from uppercase to lowercase of the value of "x" variable which is stored on "d" variable and "d" will be printed with "4)" symbol.
- "5) I LOVEjava! " comes because " I LOVEjava! " is the mixed value of the "x" and "y" variable. It prints because "x.concat(y);" statement combines the x and y value and stored in an "e" variable and "e" will be printed with "5)" symbol.
Answer:
i think its the second one
Explanation:
brainliest pls
Hey hey hey! I recently took the test and the answer is D | (• ◡•)|