Computer Science, asked by neelrex9999, 7 months ago

Write a program to print the following series: 13, 31, 17, 71, 37, 73 ... 97​

Answers

Answered by raj21425
1

Answer:

// C++ implementation of the above approach

#include "bits/stdc++.h"

using namespace std;

// Function to print the series

void printSeries(int N)

{

int ith_term = 0;

// Generate the ith term and

// print it

for (int i = 1; i <= N; i++) {

ith_term = i % 2 == 0

? 2 * i * i + 1

: 2 * i * i - 1;

cout << ith_term << ", ";

}

}

// Driver Code

int main()

{

int N = 7;

printSeries

Similar questions