Saturday, 28 December 2019

Save and Display Image / Video on database


  //Create Class

public class Common
    {
 public string ViewImage(byte[] arrayImage)
        {
            return "data:image/png;base64," + Convert.ToBase64String(arrayImage, 0, arrayImage.Length);
        }

        public string ViewVideo(byte[] arrayImage)
        {
            return "data:video/mp4;base64," + Convert.ToBase64String(arrayImage, 0, arrayImage.Length);
        }

 //****
        public String ConvertImageURLToBase64(String url)
        {
            StringBuilder _sb = new StringBuilder();
            Byte[] _byte = this.GetImage(url);
            _sb.Append(Convert.ToBase64String(_byte, 0, _byte.Length));
            return _sb.ToString();
        }

        public byte[] GetImage(string url)
        {
            Stream stream = null;
            byte[] buf;

            try
            {
                WebProxy myProxy = new WebProxy();
                HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);

                HttpWebResponse response = (HttpWebResponse)req.GetResponse();
                stream = response.GetResponseStream();

                using (BinaryReader br = new BinaryReader(stream))
                {
                    int len = (int)(response.ContentLength);
                    buf = br.ReadBytes(len);
                    br.Close();
                }

                stream.Close();
                response.Close();
            }
            catch (Exception exp)
            {
                buf = null;
            }

            return (buf);
        }
}
//************************** html code *************

Show image by url

 <img src="@cm.ViewImage( cm.GetImage("https://www.aswtech.in/Content/Home/images/slider/fraction/3.png"))" width="300px" height="200px" alt="Alternate Text" /> 

Show Image /Vidwo From Database

 <video   src='@cm.ViewVideo((byte[])dt.Rows[i]["XDATA"])' controls="true"  width="400" height="350" loop="true"/>


 <img src="@cm.ViewImage((byte[])dt.Rows[i]["XDATA"])" width="300px" height="200px" alt="Alternate Text" /> 

Database Table

CREATE TABLE [dbo].[PROMOTION](
[SRNO] [int] IDENTITY(1,1) NOT NULL,
[TDATE] [datetime] NULL,
[XDATA] [varbinary](max) NULL
)

Convert uploaded File to bytes  array
 public ActionResult AddPromotion(FormCollection frm, HttpPostedFileBase file1)
        {

byte[] bytes = null;
       
            if (file1 != null)
            {
                  path = Path.GetFileName(file1.FileName);


                using (BinaryReader br = new BinaryReader(file1.InputStream))
                {
                    bytes = br.ReadBytes(file1.ContentLength);
                }
            }
//Save bytes to database

}




Thursday, 26 December 2019

Convert DataTable to List In C#

  1. Using a Loop.
  1. Using LINQ.
  1. Using a Generic Method.
Convert DataTable to List Using a Loop

DataTable dt = new DataTable("Student"); 
dt.Columns.Add("StudentId", typeof(Int32)); 
dt.Columns.Add("StudentName", typeof(string)); 
dt.Columns.Add("Address", typeof(string)); 
dt.Columns.Add("MobileNo", typeof(string)); 
    //Data 
dt.Rows.Add(1, "Manish", "Hyderabad","0000000000"); 
dt.Rows.Add(2, "Venkat", "Hyderabad", "111111111"); 
dt.Rows.Add(3, "Namit", "Pune", "1222222222"); 
dt.Rows.Add(4, "Abhinav", "Bhagalpur", "3333333333");
public void StudentList() 

    //  DataTable dt = new DataTable("Branches"); 
    DataTable dt = new DataTable("Student"); 
    dt.Columns.Add("StudentId", typeof(Int32)); 
    dt.Columns.Add("StudentName", typeof(string)); 
    dt.Columns.Add("Address", typeof(string)); 
    dt.Columns.Add("MobileNo", typeof(string)); 
    //Data 
    dt.Rows.Add(1, "Manish", "Hyderabad", "0000000000"); 
    dt.Rows.Add(2, "Venkat", "Hyderabad", "111111111"); 
    dt.Rows.Add(3, "Namit", "Pune", "1222222222"); 
    dt.Rows.Add(4, "Abhinav", "Bhagalpur", "3333333333"); 
 
    List<Student> studentList = new List<Student>(); 
    for (int i = 0; i < dt.Rows.Count; i++) 
    { 
        Student student = new Student(); 
        student.StudentId = Convert .ToInt32 (dt.Rows[i]["StudentId"]); 
        student.StudentName = dt.Rows[i]["StudentName"].ToString(); 
        student.Address = dt.Rows[i]["Address"].ToString(); 
        student.MobileNo = dt.Rows[i]["MobileNo"].ToString(); 
        studentList.Add(student); 
    } 
}

Convert DataTable to List Using Linq


public void StudentListUsingLink() 

    //  DataTable dt = new DataTable("Branches"); 
    DataTable dt = new DataTable("Student"); 
    dt.Columns.Add("StudentId", typeof(Int32)); 
    dt.Columns.Add("StudentName", typeof(string)); 
    dt.Columns.Add("Address", typeof(string)); 
    dt.Columns.Add("MobileNo", typeof(string)); 
    //Data 
    dt.Rows.Add(1, "Manish", "Hyderabad", "0000000000"); 
    dt.Rows.Add(2, "Venkat", "Hyderabad", "111111111"); 
    dt.Rows.Add(3, "Namit", "Pune", "1222222222"); 
    dt.Rows.Add(4, "Abhinav", "Bhagalpur", "3333333333"); 
    List<Student> studentList = new List<Student>(); 
    studentList = (from DataRow dr in dt.Rows 
            select new Student() 
            { 
                StudentId = Convert .ToInt32 (dr["StudentId"]), 
                StudentName = dr["StudentName"].ToString(), 
                Address = dr["Address"].ToString(), 
                MobileNo = dr["MobileNo"].ToString() 
            }).ToList(); 
   

Convert DataTable to List using a Generic Method

private static List<T> ConvertDataTable<T>(DataTable dt) 

    List<T> data = new List<T>(); 
    foreach (DataRow row in dt.Rows) 
    { 
        T item = GetItem<T>(row); 
        data.Add(item); 
    } 
    return data; 

private static T GetItem<T>(DataRow dr) 

    Type temp = typeof(T); 
    T obj = Activator.CreateInstance<T>(); 
 
    foreach (DataColumn column in dr.Table.Columns) 
    { 
        foreach (PropertyInfo pro in temp.GetProperties()) 
        { 
            if (pro.Name == column.ColumnName) 
                pro.SetValue(obj, dr[column.ColumnName], null); 
            else 
                continue; 
        } 
    } 
    return obj; 
}
List< Student > studentDetails = new List< Student >(); 
studentDetails = ConvertDataTable< Student >(dt);
x

Bind value to multi class


*******************Singel Item Binding********************
 public class Student
    {
        public int StudentId { get; set; }
        [Display(Name = "Name")]
        public string StudentName { get; set; }
        public int Age { get; set; }
        public Standard standard { get; set; }
   
    }

    public class Standard
    {
        public int StandardId { get; set; }
        public string StandardName { get; set; }
    }

bind to class

 Student s = new Student();
       s.Age = 25;
       s.standard.StandardId = 25;
       s.standard.StandardName = "New Sand";
       s.StudentId=2;
       s.StudentName = "Samir";

***********************************

*******************List of Item Binding********************

  public class Student
    {
        public int StudentId { get; set; }
        [Display(Name = "Name")]
        public string StudentName { get; set; }
        public int Age { get; set; }
        public List<Standard> listStad { get; set; }
    }

    public class Standard
    {
        public int StandardId { get; set; }
        public string StandardName { get; set; }
    }

bind to class
 Student s = new Student();
            s.Age = 25;
            s.listStad =
                      new List<Standard>() {
                                        new Standard { StandardId = 25, StandardName = "Samir" },
                                        new Standard { StandardId = 26, StandardName = "samir 02" }
                         };
            s.StudentId=2;
            s.StudentName = "Samir";

******************************************************

Bind data By Datatable

public class Group
    {
        public string name { get; set; }
        public string id { get; set; }
        public bool expanded { get; set; }
        public List<Resoruce> children { get; set; }
    }
    public class Resoruce
    {
        public string name { get; set; }
        public string id { get; set; }
        public string groupid { get; set; }
    }


public ActionResult ShowData()
        {
            dal.ClearParameters();
            dal.AddParameter("@MODE", "SELECT_GROUP", "IN");
            DataTable dtgroup = dal.GetTable("SP_EVENTS", ref Message);

            dal.ClearParameters();
            dal.AddParameter("@MODE", "SELECT_SCHE_GROUP_MEMBER_SHOW", "IN");
            DataTable dtres = dal.GetTable("SP_EVENTS", ref Message);

            List<Group> groups = new List<Group>();
            for (int i = 0; i < dtgroup.Rows.Count; i++)
            {
                Group group = new Group
                {
                    id = dtgroup.Rows[i]["ID"].ToString(),
                    name = dtgroup.Rows[i]["name"].ToString(),
                    expanded = true,
                    children = getResoruce(dtgroup.Rows[i]["groupId"].ToString(), dtres)
                };
                groups.Add(group);
            }
            ViewBag.Datax = groups;
            return View();
        }
        public List<Resoruce> getResoruce(string groupId, DataTable resours)
        {
            DataRow[] result = resours.Select("groupId='" + groupId + "'");
            List<Resoruce> detail = new List<Resoruce>();
            foreach (var item in result)
            {
                detail.Add(new Resoruce
                    {
                        groupid = item["groupId"].ToString(),
                        id = item["id"].ToString(),
                        name = item["name"].ToString()
                    });
            }

            return detail;
        }


Tuesday, 1 October 2019

Practice Questions Using Loop

1. Write a program in C to display the first 10 natural numbers.
Expected Output :
1 2 3 4 5 6 7 8 9 10


2. Write a C program to find the sum of first 10 natural numbers.
Expected Output :
The first 10 natural number is :
1 2 3 4 5 6 7 8 9 10
The Sum is : 55


3. Write a program in C to display n terms of natural number and their sum.
Test Data : 7
Expected Output :
The first 7 natural number is :
1 2 3 4 5 6 7
The Sum of Natural Number upto 7 terms : 28


4. Write a program in C to read 10 numbers from keyboard and find their sum and average.
Test Data :
Input the 10 numbers :
Number-1 :2
...
Number-10 :2
Expected Output :
The sum of 10 no is : 55
The Average is : 5.500000


5. Write a program in C to display the cube of the number upto given an integer.
Test Data :
Input number of terms : 5
Expected Output :
Number is : 1 and cube of the 1 is :1
Number is : 2 and cube of the 2 is :8
Number is : 3 and cube of the 3 is :27
Number is : 4 and cube of the 4 is :64
Number is : 5 and cube of the 5 is :125


6. Write a program in C to display the multiplication table of a given integer.
Test Data :
Input the number (Table to be calculated) : 15
Expected Output :
15 X 1 = 15
...
...
15 X 10 = 150


7. Write a program in C to display the multipliaction table vertically from 1 to n.
Test Data :
Input upto the table number starting from 1 : 8
Expected Output :
Multiplication table from 1 to 8
1x1 = 1, 2x1 = 2, 3x1 = 3, 4x1 = 4, 5x1 = 5, 6x1 = 6, 7x1 = 7, 8x1 = 8
...
1x10 = 10, 2x10 = 20, 3x10 = 30, 4x10 = 40, 5x10 = 50, 6x10 = 60, 7x10 = 70, 8x10 = 80


8. Write a program in C to display the n terms of odd natural number and their sum .
Test Data
Input number of terms : 10
Expected Output :
The odd numbers are :1 3 5 7 9 11 13 15 17 19
The Sum of odd Natural Number upto 10 terms : 100


9. Write a program in C to display the pattern like right angle triangle using an asterisk.

The pattern like :

*
**
***
****


10. Write a program in C to display the pattern like right angle triangle with a number.

The pattern like :

1
12
123
1234


11. Write a program in C to make such a pattern like right angle triangle with a number which will repeat a number in a row.

The pattern like :

 1
 22
 333
 4444


12. Write a program in C to make such a pattern like right angle triangle with number increased by 1.

The pattern like :

   1
   2 3
   4 5 6
   7 8 9 10


13. Write a program in C to make such a pattern like a pyramid with numbers increased by 1.
   1
  2 3
 4 5 6
7 8 9 10

14. Write a program in C to make such a pattern like a pyramid with an asterisk.

   *
  * *
 * * *
* * * *


15. Write a C program to calculate the factorial of a given number.
Test Data :
Input the number : 5
Expected Output :
The Factorial of 5 is: 120


16. Write a program in C to display the n terms of even natural number and their sum.
Test Data :
Input number of terms : 5
Expected Output :
The even numbers are :2 4 6 8 10
The Sum of even Natural Number upto 5 terms : 30


17. Write a program in C to make such a pattern like a pyramid with a number which will repeat the number in the same row.

   1
  2 2
 3 3 3
4 4 4 4


18. Write a program in C to find the sum of the series [ 1-X^2/2!+X^4/4!- .........].
Test Data :
Input the Value of x :2
Input the number of terms : 5
Expected Output :
the sum = -0.415873
Number of terms = 5
value of x = 2.000000


19. Write a program in C to display the n terms of harmonic series and their sum.
1 + 1/2 + 1/3 + 1/4 + 1/5 ... 1/n terms
Test Data :
Input the number of terms : 5
Expected Output :
1/1 + 1/2 + 1/3 + 1/4 + 1/5 +
Sum of Series upto 5 terms : 2.283334


20. Write a program in C to display the pattern like a pyramid using asterisk and each row contain an odd number of asterisks.

   *
  ***
 *****


21. Write a program in C to display the sum of the series [ 9 + 99 + 999 + 9999 ...].
Test Data :
Input the number or terms :5
Expected Output :
9 99 999 9999 99999
The sum of the saries = 111105


22. Write a program in C to print the Floyd's Triangle.

1
01
101
0101
10101

23. Write a program in C to display the sum of the series [ 1+x+x^2/2!+x^3/3!+....].
Test Data :
Input the value of x :3
Input number of terms : 5
Expected Output :
The sum is : 16.375000


24. Write a program in C to find the sum of the series [ x - x^3 + x^5 + ......].
Test Data :
Input the value of x :2
Input number of terms : 5
Expected Output :
The values of the series:
2
-8
32
-128
512
The sum = 410


25. Write a program in C to display the n terms of square natural number and their sum.
1 4 9 16 ... n Terms
Test Data :
Input the number of terms : 5
Expected Output :
The square natural upto 5 terms are :1 4 9 16 25
The Sum of Square Natural Number upto 5 terms = 55


26. Write a program in C to find the sum of the series 1 +11 + 111 + 1111 + .. n terms.
Test Data :
Input the number of terms : 5
Expected Output :
1 + 11 + 111 + 1111 + 11111
The Sum is : 12345


27. Write a c program to check whether a given number is a perfect number or not.
Test Data :
Input the number : 56
Expected Output :
The positive divisor : 1 2 4 7 8 14 28
The sum of the divisor is : 64
So, the number is not perfect.


28. Write a c program to find the perfect numbers within a given number of range.
Test Data :
Input the starting range or number : 1
Input the ending range of number : 50
Expected Output :
The Perfect numbers within the given range : 6 28


29. Write a C program to check whether a given number is an armstrong number or not.
Test Data :
Input a number: 153
Expected Output :
153 is an Armstrong number.


30. Write a C program to find the Armstrong number for a given range of number.
Test Data :
Input starting number of range: 1
Input ending number of range : 1000
Expected Output :
Armstrong numbers in given range are: 1 153 370 371 407


31. Write a program in C to display the pattern like a diamond.

    *
   ***
  *****
 *******
*********
 *******
  *****
   ***
    *


32. Write a C program to determine whether a given number is prime or not.
 Test Data :
Input a number: 13
Expected Output :
13 is a prime number.


33. Write a C program to display Pascal's triangle.
 Test Data :
Input number of rows: 5
Expected Output :

        1
      1   1
    1   2   1
  1   3   3   1
1   4   6   4   1

34. Write a program in C to find the prime numbers within a range of numbers.
Test Data :
Input starting number of range: 1
Input ending number of range : 50
Expected Output :
The prime number between 1 and 50 are :
2 3 5 7 11 13 17 19 23 29 31 37 41 43 47


35. Write a program in C to display the first n terms of Fibonacci series.
Fibonacci series 0 1 2 3 5 8 13 .....
Test Data :
Input number of terms to display : 10
Expected Output :
Here is the Fibonacci series upto to 10 terms :
0 1 1 2 3 5 8 13 21 34


36. Write a program in C to display the such a pattern for n number of rows using a number which will start with the number 1 and the first and a last number of each row will be 1.

  1
 121
12321

37. Write a program in C to display the number in reverse order.
Test Data :
Input a number: 12345
Expected Output :
The number in reverse order is : 54321


38. Write a program in C to check whether a number is a palindrome or not.
Test Data :
Input a number: 121
Expected Output :
121 is a palindrome number.


39. Write a program in C to find the number and sum of all integer between 100 and 200 which are divisible by 9.
Expected Output :
Numbers between 100 and 200, divisible by 9 :
108 117 126 135 144 153 162 171 180 189 198
The sum : 1683


40. Write a C Program to display the pattern like pyramid using the alphabet.

        A
      A B A
    A B C B A
  A B C D C B A


41. Write a program in C to convert a decimal number into binary without using an array.
Test Data :
Enter a number to convert : 25
Expected Output :
The Binary of 25 is 11001.


42. Write a program in C to convert a binary number into a decimal number without using array, function and while loop.
Test Data :
Input a binary number :1010101
Expected Output :
The Binary Number : 1010101
The equivalent Decimal Number : 85


43. Write a C program to find HCF (Highest Common Factor) of two numbers.
Test Data :
Input 1st number for HCF: 24
Input 2nd number for HCF: 28
Expected Output :
HCF of 24 and 28 is : 4


44. Write a program in C to find LCM of any two numbers using HCF.
Test Data :
Input 1st number for LCM: 15
Input 2nd number for LCM: 20
Expected Output :
The LCM of 15 and 20 is : 60


45. Write a program in C to find LCM of any two numbers.
Test Data :
Input 1st number for LCM: 15
Input 2nd number for LCM: 20
Expected Output :
The LCM of 15 and 20 is : 60


46. Write a program in C to convert a binary number into a decimal number using math function.
Test Data :
Input the binary number :1010100
Expected Output :
The Binary Number : 1010100
The equivalent Decimal Number is : 84


47. Write a C program to check whether a number is a Strong Number or not.
Test Data :
Input a number to check whether it is Strong number: 15
Expected Output :
15 is not a Strong number.


48. Write a C program to find Strong Numbers within a range of numbers.
Test Data :
Input starting range of number : 1
Input ending range of number: 200
Expected Output :
The Strong numbers are :
1 2 145


49. Write a c program to find out the sum of an A.P. series.
Test Data :
Input the starting number of the A.P. series: 1
Input the number of items for the A.P. series: 10
Input the common difference of A.P. series: 4
Expected Output :
The Sum of the A.P. series are :
1 + 5 + 9 + 13 + 17 + 21 + 25 + 29 + 33 + 37 = 190


50. Write a program in C to convert a decimal number into octal without using an array.
Test Data :
Enter a number to convert : 79
Expected Output :
The Octal of 79 is 117.


51. Write a program in C to convert an octal number to a decimal without using an array.
Test Data :
Input an octal number (using digit 0 - 7) :745
Expected Output :
The Octal Number : 745
The equivalent Decimal Number : 485


52. Write a program in c to find the Sum of GP series.
Test Data :
Input the first number of the G.P. series: 3
Input the number or terms in the G.P. series: 5
Input the common ratio of G.P. series: 2
Expected Output :
The numbers for the G.P. series:
3.000000 6.000000 12.000000 24.000000 48.000000
The Sum of the G.P. series : 93.000000


53. Write a program in C to convert a binary number to octal.
Test Data :
Input a binary number :1001
Expected Output :
The Binary Number : 1001
The equivalent Octal Number : 11


54. Write a program in C to convert an octal number into binary.
Test Data :
Input an octal number (using digit 0 - 7) :57
Expected Output :
The Octal Number : 57
The equivalent Binary Number : 101111



55. Write a program in C to convert a decimal number to hexadecimal.
Test Data :
Input any Decimal number: 79
Expected Output :
The equivalent Hexadecimal Number : 4F


56. Write a program in C to Check Whether a Number can be Express as Sum of Two Prime Numbers.
Test Data :
Input a positive integer: 16
Expected Output :
16 = 3 + 13
16 = 5 + 11


57. Write a program in C to print a string in reverse order.
Test Data :
Input a string to reverse : Welcome
Expected Output :
Reversed string is: emocleW


58. Write a C program to find the length of a string without using the library function.
Test Data :
Input a string : welcome
Expected Output :
The string contains 7 number of characters.
So, the length of the string welcome is : 7


59. Write a program in C to check Armstrong number of n digits.
Test Data :
Input an integer : 1634
Expected Output :
1634 is an Armstrong number

Practice Questions Using If Condition

1. Write a C program to accept two integers and check whether they are equal or not.
Test Data : 15 15
Expected Output :
Number1 and Number2 are equal


2. Write a C program to check whether a given number is even or odd. 
Test Data : 15
Expected Output :
15 is an odd integer


3. Write a C program to check whether a given number is positive or negative. 
Test Data : 15
Expected Output :
15 is a positive number


4. Write a C program to find whether a given year is a leap year or not. 
Test Data : 2016
Expected Output :
2016 is a leap year.


5. Write a C program to read the age of a candidate and determine whether it is eligible for casting his/her own vote. 
Test Data : 21
Expected Output :
Congratulation! You are eligible for casting your vote.


6. Write a C program to read the value of an integer m and display the value of n is 1 when m is larger than 0, 0 when m is 0 and -1 when m is less than 0.
Test Data : -5
Expected Output :
The value of n = -1


7. Write a C program to accept the height of a person in centimeter and categorize the person according to their height.
Test Data : 135
Expected Output :
The person is Dwarf.


8. Write a C program to find the largest of three numbers.
Test Data : 12 25 52
Expected Output :
1st Number = 12,        2nd Number = 25,        3rd Number = 52
The 3rd Number is the greatest among three


9. Write a C program to accept a coordinate point in a XY coordinate system and determine in which quadrant the coordinate point lies.
Test Data : 7 9
Expected Output :
The coordinate point (7,9) lies in the First quadrant.


10. Write a C program to find the eligibility of admission for a professional course based on the following criteria:
Marks in Maths >=65
Marks in Phy >=55
Marks in Chem>=50
Total in all three subject >=180
or
Total in Math and Subjects >=140

Test Data :
Input the marks obtained in Physics :65
Input the marks obtained in Chemistry :51
Input the marks obtained in Mathematics :72
Expected Output :
The candidate is eligible for admission.


11. Write a C program to calculate the root of a Quadratic Equation.
Test Data : 1 5 7
Expected Output :
Root are imaginary;
No solution.


12. Write a C program to read roll no, name and marks of three subjects and calculate the total, percentage and division.
Test Data :
Input the Roll Number of the student :784
Input the Name of the Student :James
Input the marks of Physics, Chemistry and Computer Application : 70 80 90
Expected Output :
Roll No : 784
Name of Student : James
Marks in Physics : 70
Marks in Chemistry : 80
Marks in Computer Application : 90
Total Marks = 240
Percentage = 80.00
Division = First


13. Write a C program to read temperature in centigrade and display a suitable message according to temperature state below :
Temp < 0 then Freezing weather
Temp 0-10 then Very Cold weather
Temp 10-20 then Cold weather
Temp 20-30 then Normal in Temp
Temp 30-40 then Its Hot
Temp >=40 then Its Very Hot
Test Data :
42
Expected Output :
Its very hot.


14. Write a C program to check whether a triangle is Equilateral, Isosceles or Scalene.
Test Data :
50 50 60
Expected Output :
This is an isosceles triangle.


15. Write a C program to check whether a triangle can be formed by the given value for the angles.
Test Data :
40 55 65
Expected Output :
The triangle is not valid.


16. Write a C program to check whether a character is an alphabet, digit or special character.
Test Data :
@
Expected Output :
This is a special character.


17. Write a C program to check whether an alphabet is a vowel or consonant.
Test Data :
k
Expected Output :
The alphabet is a consonant.


18. Write a C program to calculate profit and loss on a transaction.
Test Data :
500 700
Expected Output :
You can booked your profit amount : 200


19. Write a program in C to calculate and print the Electricity bill of a given customer. The customer id., name and unit consumed by the user should be taken from the keyboard and display the total amount to pay to the customer. The charge are as follow :

Unit Charge/unit
upto 199 @1.20
200 and above but less than 400 @1.50
400 and above but less than 600 @1.80
600 and above @2.00
If bill exceeds Rs. 400 then a surcharge of 15% will be charged and the minimum bill should be of Rs. 100/-

Test Data :
1001
James
800
Expected Output :
Customer IDNO :1001
Customer Name :James
unit Consumed :800
Amount Charges @Rs. 2.00 per unit : 1600.00
Surchage Amount : 240.00
Net Amount Paid By the Customer : 1840.00



20. Write a program in C to accept a grade and declare the equivalent description :

Grade Description
E Excellent
V Very Good
G Good
A Average
F Fail
Test Data :
Input the grade :A
Expected Output :
You have chosen : Average


21. Write a program in C to read any day number in integer and display day name in the word.
Test Data :
4
Expected Output :
Thursday


22. Write a program in C to read any digit, display in the word.
Test Data :
4
Expected Output :
Four


23. Write a program in C to read any Month Number in integer and display Month name in the word.
Test Data :
4
Expected Output :
April


24. Write a program in C to read any Month Number in integer and display the number of days for this month.
Test Data :
7
Expected Output :
Month have 31 days


25. Write a program in C which is a Menu-Driven Program to compute the area of the various geometrical shape.
Test Data :
1
5
Expected Output :
The area is : 78.500000


26. Write a program in C which is a Menu-Driven Program to perform a simple calculation.
Test Data :
10
2
3
Expected Output :
The Multiplication of 10 and 2 is: 20