Computer Science, asked by ishaanpaul138114, 12 days ago

Write a program in C to display the 1st 10 terms of the series using for loop:
3, 6, 12, 24

Answers

Answered by anindyaadhikari13
2

\texttt{\textsf{\large{\underline{Solution}:}}}

The given co‎de is written in C.

#include <stdio.h>

int main() {

   for(int i=1,a=3;i<=10;i++,a*=2)

       printf("%d ",a);

   return 0;

}

\texttt{\textsf{\large{\underline{Logic}:}}}

  • Initialise a = 3.
  • Repeat i = 1 to 10
  •   Display the value of a.
  •   a = a * 2

See the attachment for output.

Attachments:
Similar questions