Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1.তিনটা সংখ্যার ভিতর বড় সংখ্যা নির্নয় এর c# প্রোগ্রাম লিখ।
- using System;
- using System.Collections.Generic;
- using System.Text;
- namespace Program
- {
- class Big_number
- {
- static void Main(String[] args)
- {
- int num1, num2, num3;
- Console.Write("Enter your first numebr: ");
- num1 =Convert.ToInt32( Console.ReadLine());
- Console.Write("Enter your first numebr: ");
- num2 = Convert.ToInt32(Console.ReadLine());
- Console.Write("Enter your first numebr: ");
- num3 = Convert.ToInt32(Console.ReadLine());
- if (num1 > num2 && num1 > num3)
- {
- Console.WriteLine("The large number is =" + num1);
- }
- else if (num2 > num1 && num2 > num3)
- {
- Console.WriteLine("The large number is =" + num2);
- }
- else
- {
- Console.WriteLine("The large number is =" + num3);
- }
- Console.ReadKey();
- }
- }
- }
- 2.দ্বিঘাত সমীকরণের মূল বের করার জন্য c# প্রোগ্রাম লিখ।
- using System;
- using System.Collections.Generic;
- using System.Text;
- namespace Program
- {
- class dighat_somikoron
- {
- static void Main(string[] args)
- {
- int a, b, c;
- double d, x1, x2;
- Console.Write("Input the value of a : ");
- a = Convert.ToInt32(Console.ReadLine());
- Console.Write("Input the value of b : ");
- b = Convert.ToInt32(Console.ReadLine());
- Console.Write("Input the value of c : ");
- c = Convert.ToInt32(Console.ReadLine());
- d = b * b - 4 * a * c;
- if (d == 0)
- {
- Console.Write("Both roots are equal.\n");
- x1 = -b / (2.0 * a);
- x2 = x1;
- Console.Write("First Root Root1= {0}\n", x1);
- Console.Write("Second Root Root2= {0}\n", x2);
- }
- else if (d > 0)
- {
- Console.Write("Both roots are real and diff-2\n");
- x1 = (-b + Math.Sqrt(d)) / (2 * a);
- x2 = (-b - Math.Sqrt(d)) / (2 * a);
- Console.Write("First Root Root1= {0}\n", x1);
- Console.Write("Second Root root2= {0}\n", x2);
- }
- else
- Console.Write("Root are imeainary;\nNo Solution. \n\n");
- }
- }
- }
- ৩. মাল্টিলেভেল ইনহেরিটেন্স ব্যবহার করে c# প্রোগ্রাম লিখ।
- using System;
- using System.Collections.Generic;
- using System.Text;
- namespace Program
- {
- class A
- {
- public void show()
- {
- Console.WriteLine("Welcome to the world of c#");
- }
- }
- class B : A //class B is derived by class A
- {
- public void display()
- {
- Console.WriteLine("Hello");
- }
- }
- class C : B //class C is derived by class B
- {
- public void show1()
- {
- Console.WriteLine("How are You ?");
- }
- class Multilevel_inheritench
- {
- public static void Main()
- {
- C obj = new C();
- obj.show();
- obj.display();
- obj.show1();
- }
- }
- }
- }
- ৪. ১ থেকে ১০০ পর্যন্ত প্রাই নাম্বার বের করার c# প্রোগ্রাম লিখ।
- using System;
- using System.Collections.Generic;
- using System.Text;
- namespace Program
- {
- class Prime_Number
- {
- static void Main(String[] args)
- {
- int count = 0,n;
- Console.WriteLine("Prime numbers between 1 and 100 are: ");
- for (int i = 1; i < 101; i++)
- {
- count = 0;
- if (i > 1)
- {
- for (int j = 2; j < i; j++)
- {
- if (i % j == 0)
- {
- count = 1;
- break;
- }
- }
- if (count == 0)
- {
- Console.Write(i + " ");
- }
- }
- }
- }
- }
- }
- ৫। array ব্যবহার করে ১০ টি সংখার মাঝে বড় সংখ্যা মাঝে বড় সংখ্যাটি বের করার প্রোগ্রাম।
- using System;
- using System.Collections.Generic;
- using System.Text;
- namespace Program
- {
- class Array
- {
- static void Main(String[] args)
- {
- int i = 0;
- int large = 0;
- int[] arr = new int[10];
- Console.WriteLine("Enter array elements : ");
- for (i = 0; i < arr.Length; i++)
- {
- Console.Write("Element[" + (i + 1) + "]: ");
- arr[i] = int.Parse(Console.ReadLine());
- }
- large = arr[0];
- for (i = 1; i < arr.Length; i++)
- {
- if (large < arr[i])
- large = arr[i];
- }
- Console.WriteLine("Largest element in array : " + large);
- }
- }
- }
- ৬। ইন্টারফেস ব্যবহার করে একটা প্রোগ্রাম ।
- Live Demo
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System;
- namespace InterfaceApplication {
- public interface ITransactions {
- // interface members
- void showTransaction();
- double getAmount();
- }
- public class Transaction : ITransactions {
- private string tCode;
- private string date;
- private double amount;
- public Transaction() {
- tCode = " ";
- date = " ";
- amount = 0.0;
- }
- public Transaction(string c, string d, double a) {
- tCode = c;
- date = d;
- amount = a;
- }
- public double getAmount() {
- return amount;
- }
- public void showTransaction() {
- Console.WriteLine("Transaction: {0}", tCode);
- Console.WriteLine("Date: {0}", date);
- Console.WriteLine("Amount: {0}", getAmount());
- }
- }
- class Tester {
- static void Main(string[] args) {
- Transaction t1 = new Transaction("001", "8/10/2012", 78900.00);
- Transaction t2 = new Transaction("002", "9/10/2012", 451900.00);
- t1.showTransaction();
- t2.showTransaction();
- Console.ReadKey();
- }
- }
- }
- https://drive.google.com/file/d/1JbmbBZJtSs9Q1gSQlNy8NWM4wNxHRfe0/view?usp=sharing
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement