0% found this document useful (0 votes)
40 views7 pages

Darshita Kumbhani

This document contains instructions for an assessment on C# programming skills. It lists 8 requirements including writing programs to get month name from number, check leap year, print multiplication table, convert decimal to binary, count letters in text, implement multiple inheritance using interfaces, demonstrate use of delegates, and find highest and lowest numbers in an array.

Uploaded by

hk
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views7 pages

Darshita Kumbhani

This document contains instructions for an assessment on C# programming skills. It lists 8 requirements including writing programs to get month name from number, check leap year, print multiplication table, convert decimal to binary, count letters in text, implement multiple inheritance using interfaces, demonstrate use of delegates, and find highest and lowest numbers in an array.

Uploaded by

hk
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

RK UNIVERSITY

Faculty of
Technology TCIE II
(Sept – 2023)
Semester – 5
Date: 21-9-2023 Branch: BCA
Subject Name: Windows Application Development Using C# Subject code: BCA511

Answer Sheet

Division: E Exam Time: SET: 4


EnrollmentNo: Name: Darshita Kumbhani
RollNo:
------------------------------------------------------------------------------------------------------------------------------
----

Instructions to Candidates:
1. Please fill Division, Exam Time, Set of Paper, Enrollment No., Name & RollNo.
2. You will save this file & upload your saved file with the file name is
{rollno_enroll_name_Answersheet}.
3. This assessment is intended to test the hands on skills related C# Programming.

Requir Requirement Description Mar


e- ks
ment
ID
1 Write a program to Get Month Name From Month Number
[take
input from user].
using System;

class Program
{
static void Main()
{

Console.Write("Enter a month number (1-12): ");


if (int.TryParse(Console.ReadLine(), out int monthNumber))
{

if (monthNumber >= 1 && monthNumber <= 12)


{
string[] monthNames = {
"January", "February", "March", "April", "May",
"June",
"July", "August", "September", "October",
"November", "December"
};

string monthName = monthNames[monthNumber - 1];

Console.WriteLine($"The month corresponding to the


number {monthNumber} is {monthName}.");
}
else
{
Console.WriteLine("Invalid input. Please enter a month
number between 1 and 12.");
}
}
else
{
Console.WriteLine("Invalid input. Please enter a valid
number.");
}
Console.ReadKey();
}
}

2 Write a program to find Leap Year?


using System;
class Program
{
static void Main()
{

Console.Write("Enter a year: ");


if (int.TryParse(Console.ReadLine(), out int year))
{

if (IsLeapYear(year))
{
Console.WriteLine($"{year} is a leap year.");
}
else
{
Console.WriteLine($"{year} is not a leap year.");
}
}
else
{
Console.WriteLine("Invalid input. Please enter a valid
year.");
}Console.ReadKey();
}

static bool IsLeapYear(int year)


{

return (year % 4 == 0 && year % 100 != 0) || (year % 400 ==


0);
}
}

3 Write a program which print multiplication table as below.


using System;
class Program
{
static void Main()
{
Console.Write("Enter the number table: ");
if (int.TryParse(Console.ReadLine(), out int number))
{

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


{
int result = number * i;
Console.WriteLine($"{number} x {i} = {result}");
}
}
else
{
Console.WriteLine("Invalid input. Please enter a valid
number.");
}
Console.ReadKey();
}
}
4 Write a program which covert decimal into binary.
using System;

class Program
{
static void Main()
{
Console.Write("Enter a number: ");
if (int.TryParse(Console.ReadLine(), out int decimalNumber))
{
string binary = Convert.ToString(decimalNumber, 2);
Console.WriteLine($"Binary representation: {binary}");
}
else
{
Console.WriteLine("Invalid input. Please enter a valid
decimal number.");
}Console.ReadKey();
}
}
5 Write a program to count no letter in text.
using System;
class Program
{
static void Main()
{

string myString = Console.ReadLine();


int count = 0;

for (int i = 0; i < myString.Length; i++)


{
if (!char.IsWhiteSpace(myString[i]))
{
count++;
}
}

Console.WriteLine("Total letters: " + count);


Console.ReadLine();
}
}

6 Write a program which implements multiple inheritances using


Interface.

7 Write a Program which demonstrates the use of delegates.


8 Write a Program which Find highest and lowest Number in an
Array

You might also like