Computer Science, asked by niludevi375, 8 months ago

UL ULUDE
Write a program by using a class with the following specifications
Class name : Factorial
Data members : private int n
Member functions:
void input(): to input a number
void fact(): to find and print the factorial of the number.
Use a main function to create an object and call member
create an object and call member methods of the class,
Encapsulation and Inheritance​

Answers

Answered by priyanshupriyal2008
1

Answer:

এ একটিসাধারণডকুমেন্ট তৈরীকরেপ্রিন্টকরারপদ্ধতিবর্ণনা কর ।

টাব সেট করা, মার্জিনইনডেন্টকরাএবং টেবুট এলাইনমেন্টকরারপদ্ধতিবর্ণনা

একটভকুমেন্ট তৈরীকরেড্রাইভে সেভ করারপদ্ধতিবর্ণনা কর ।

একটভকুমেন্ট তৈরীকরেবিভিন্নসাইজ, ধরন, রং ও ফন্ট

পরিবর্তন করারষ্পদ্ধতিবর্ণনা কর ।

বাে এবং কলমকী ? ৪টি কলাম ও ৫টি রাে বিশিষ্ট টেবিল তৈ

Explanation:

এ একটিসাধারণডকুমেন্ট তৈরীকরেপ্রিন্টকরারপদ্ধতিবর্ণনা কর ।

টাব সেট করা, মার্জিনইনডেন্টকরাএবং টেবুট এলাইনমেন্টকরারপদ্ধতিবর্ণনা

একটভকুমেন্ট তৈরীকরেড্রাইভে সেভ করারপদ্ধতিবর্ণনা কর ।

একটভকুমেন্ট তৈরীকরেবিভিন্নসাইজ, ধরন, রং ও ফন্ট

পরিবর্তন করারষ্পদ্ধতিবর্ণনা কর ।

বাে এবং কলমকী ? ৪টি কলাম ও ৫টি রাে বিশিষ্ট টেবিল তৈ

Answered by askomala1205gmailcom
0

Answer:

import java.util.Scanner;

public class Factorial

{

private int n;

public void input() {

Scanner in = new Scanner(System.in);

System.out.print("Enter the number: ");

n = in.nextInt();

}

public void fact() {

int f = 1;

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

f *= i;

System.out.println("Factorial of " + n

+ " = " + f);

}

public static void main(String args[]) {

Factorial obj = new Factorial();

obj.input();

obj.fact();

}

}

OUTPUT

BlueJ output of Write a program by using a class with the following specifications: Class name — Factorial Data members — private int n Member functions: (a) void input() — to input a number (b) void fact() — to find and print the factorial of the number Use a main function to create an object and call member methods of the class.

Similar questions