Computer Science, asked by nidhi8551, 1 year ago

write the program to display the following series of numbers is 100,97,94,91,.....,4,1.​

Answers

Answered by rakeshchennupati143
15

Answer:

you dint say in which language so i;m writing in python

i=100

while(i>=0):

  print(i)

  i = i - 3

Answered by KailashHarjo
1

The program to display the following series of numbers is 100,97,94,91,.....,4,1.​ is

#include <stdio.h>

int main()

{

   for (int i = 100; i >= 1; i -= 3) {

       printf("%d\n", i);

}

   return 0;

}

  • The first line includes the standard input/output header file, stdio.h, which provides the printf function used to display the output.
  • This line defines the main function, which is the entry point of the program. The int return type specifies that the function should return an integer value.
  • The for loop initializes the variable i to 100 and continues until i is greater than or equal to 1. The loop decrements i by 3 on each iteration.
  • The printf function displays the value of i on each iteration of the loop, followed by a newline character \n. The %d format specifier is used to display the value as a decimal integer.

#SPJ3

Similar questions