Computer Science, asked by ksshruti12, 3 months ago

Write for loop to display the following. To display ----- Z Y X W V U

Answers

Answered by anindyaadhikari13
3

Answer:

These are the required programs for the question.

1. In Java.

public class Series {

   public static void main(String args[])  {

       for(char i='Z';i>='U';i--)

           System.out.print(i+" ");

   }

}

2. In Python.

for i in range(90,84,-1):

   print(chr(i),end=" ")

3. In C.

#include <stdio.h>

int main() {

   for(char i='Z';i>='U';i--)

       printf("%c ",i);

   return 0;

}

4. In C++

#include <iostream>

using namespace std;

int main() {

   for(char i='Z';i>='U';i--)

       cout<<i<<" ";

   return 0;

}

•••♪

Answered by BrainlyProgrammer
5

Answer:

This Program is done in JAVA

Method 1: Using Char Loop

class Loop{

public static void main (String ar []){

for(char I='Z';I>='A';I--)

System.out.print(I+" ");

}

}

_

Method 2: Using ASCII côdes

class Loop{

public static void main (String ar []){

for(int I=90;I>=65;I--)

System.out.print((char)I+" ");

}

}

_

•Output Attached

_

•••♪♬

Attachments:
Similar questions