Last active
May 7, 2021 02:23
-
-
Save singhkunal2050/9ab6d51788b5595a697ec1d02fd2b243 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://code.labstack.com/csharp | |
1> write a console program in c# to create delegate which display 1 to 100 odd number | |
using System; | |
public class Code | |
{ | |
public static void Main(string[] args) | |
{ | |
int i =0; | |
for(i=0;i<100;i++){ | |
if(i%2!=0) | |
Console.Write(i + " "); | |
} | |
} | |
} | |
https://code.labstack.com/Uvs5xFvC | |
------------------------------------------------------------- | |
2> write a console program in c# to accept student name and age if the students age is not between 20 and 25 genearte user defined exception invalid age | |
using System; | |
public class InvalidAgeException : Exception | |
{ | |
public InvalidAgeException(String message) | |
: base(message) | |
{ | |
} | |
} | |
public class TestUserDefinedException | |
{ | |
static void validate(int age) | |
{ | |
if (age < 18) | |
{ | |
throw new InvalidAgeException("Sorry, Age must be greater than 18"); | |
} | |
} | |
public static void Main(string[] args) | |
{ | |
Console.Write("Enter your age "); | |
age = Convert.ToInt32(Console.ReadLine()); | |
try | |
{ | |
validate(age); | |
} | |
catch (InvalidAgeException e) { Console.WriteLine(e); } | |
Console.WriteLine("Age is Valid"); | |
} | |
} | |
------------------------------------------------------------- | |
3>write a C# program design a form which will show 3 radio buttons to check if the number is the palindrome or is a odd or prime | |
number and display appropriate msg | |
// C# program to check whether a number | |
// is Palindrome or not. | |
using System; | |
public class GFG | |
{ | |
static int isPrime(int n){ | |
int a=0; | |
for (int i = 1; i <= n; i++) { | |
if (n % i == 0) { | |
a++; | |
} | |
} | |
if (a == 2) { | |
return 1; | |
} else { | |
return 0; | |
} | |
} | |
/* Iterative function to reverse digits of num*/ | |
static int reverseDigits(int num) | |
{ | |
int rev_num = 0; | |
while (num > 0) { | |
rev_num = rev_num * 10 + num % 10; | |
num = num / 10; | |
} | |
return rev_num; | |
} | |
/* Function to check if n is Palindrome*/ | |
static int isPalindrome(int n) | |
{ | |
// get the reverse of n | |
int rev_n = reverseDigits(n); | |
// Check if rev_n and n are same or not. | |
if (rev_n == n) | |
return 1; | |
else | |
return 0; | |
} | |
/*Driver program to test reversDigits*/ | |
public static void Main() | |
{ | |
int n = 4562; | |
Console.WriteLine("Is" + n + "a Palindrome number? -> " + | |
(isPalindrome(n) == 1 ? "true" : "false")); | |
n = 11; | |
int n2=22322; | |
Console.WriteLine("Is" + n + "a Palindrome number? -> " + | |
(isPalindrome(n) == 1 ? "true" : "false")); | |
Console.WriteLine("Is" + n + "a Palindrome number? -> " + | |
(isPrime(n) == 1 ? "true" : "false")); | |
Console.WriteLine("Is" + n + "a Palindrome number? -> " + | |
(isPrime(n2) == 1 ? "true" : "false")); | |
} | |
} | |
https://code.labstack.com/jn1ekBfZ | |
------------------------------------------------------------- | |
4>design a c# program the form has a list of numbers which is stored in a single d array display buttons minimum and sum show appropriate result | |
------------------------------------------------------------- | |
5> write a C# program to display 3 text box and 2 button enter eny string into 1st or 2nd text box if the user concatanate of 2 string in 3rd textbox | |
------------------------------------------------------------- | |
6> disign a form which accept student profile in which accept the name display 4 radio button for selection of course like mca msc me aceept computer skill in | |
chechbox show 2 button submit and exit when the user click submit disply the student name and skill with pop up box | |
------------------------------------------------------------- | |
7>to search for student record using student name and roll no display student record in datagred used database | |
8>disign a form to display student details in a greed view as well as an textboxes after clicking next and prev button the student data should be stored in database | |
roll name age city | |
9> to accept emp details such as name desg date gender number show button save cancel exit save record in databse cancel button cancel the opration exit will exit | |
10>to perform opration on listbox or combobox add item remove item sort item single selection multi selection and clear item | |
11> write a program to design a form to accept date from the user using calaender control and after clicking a commond botton displayt the date | |
in textbox and provide 2 option increment the daet and decrement the date | |
12> write a program to create emp tablr with emp id name addre number on searching by emp id display the detais of emp in msg box | |
13> write a web application in asp.net use c# to design webpage use validator and validator control | |
14> write a web application in asp.net use c# to design masterpage with 2 content pages 1 page displya emp personal info 2nd display emp academic info | |
15> write a asp.net appication use c# to design login screen use view state to restore the value form textbox 1 &2 | |
16> write a asp.net appication use c# to design page accept a name of icescreem from the user and add it in listbox on clicking add button user can select multiple name | |
from listbox on clicking submit button ahould be display on a lable control | |
17> to accept stud info when the user click submit the info display on next page | |
18>write a web application in asp.net use c# to accept details emp id nsame add date type depalrtment and display in table on samere pageuse table server control | |
19>write a program in c#.net to check stud age if students age is not between 20 and 25 genearte user defined exception invalid age | |
20> write a program in c#.net to accept 2 | |
21> write a program in c#.net program to checck for array limit/size display appropriate tyupe of exception | |
22>accept temp from user and create a negative temp exception | |
23> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment