Computer Science, asked by vergil0368, 4 days ago

1 full examples of
program with questions and comments on top
Only right answers pls or else i will report you ​

Answers

Answered by ArchBTW
1

Answer:

// Including iostream

#include <iostream>

// Using the namespace to std because we don't want to write std::cout

using namespace std;

// Starting of the main function

int main() {

 int a, n; // Creating integer variable

 double S; // Creating a double variable

 cout << "Enter the value of a" << endl; // Asking for user input

 cin >> a; // User input

 cout << "Enter the value of n" << endl;

 cin >> n;

 for (int i = 2; i <= n; i++) { // Starting a for loop

   S = (double)a / i; // Setting S to a/i

 }

 cout << S << endl; // Printing the value of S

 return 0;

}

Explanation:

Plz mark it as the brainliest

Similar questions