Computer Science, asked by aditi8044, 1 year ago

Java program ..........

Attachments:

Answers

Answered by MrZeref
1

Answer:

// C program to illustrate

// Menu-Driven program

// using Switch-case

  

#include <stdio.h>

int input();

void output(float);

int main()

{

    float result;

    int choice, num;

    printf("Press 1 to calculate area of circle\n");

    printf("Press 2 to calculate area of square\n");

    printf("Press 3 to calculate area of sphere\n");

    printf("Enter your choice:\n");

    choice = input();

      

    switch (choice) {

    case 1: {

        printf("Enter radius:\n");

        num = input();

        result = 3.14 * num * num;

        printf("Area of sphere=");

        output(result);

        break;

    }

    case 2: {

        printf("Enter side of square:\n");

        num = input();

        result = num * num;

        printf("Area of square=");

        output(result);

        break;

    }

    case 3: {

        printf("Enter radius:\n");

        num = input();

        result = 4 * (3.14 * num * num);

        printf("Area of sphere=");

        output(result);

        break;

    }

    default:

        printf("wrong Input\n");

    }

    return 0;

}

Answered by anindyaadhikari13
26

Answer:

class Pattern

{

static void main()

{

int n=5;

for(int i=1;i<=n;i++)

{

for(int j=i;j>=1;j--)

{

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

}

System.out.println();

}

}

}

Explanation:

&lt;marquee&gt;Hope it helps you...Please mark this answer as the brainliest and follow me..&lt;/marquee&gt;

Similar questions