Page

C programming code to merge two sorted arrays

#include <stdio.h>
#include <conio.h> 
void merge(int [], int, int [], int, int []);

int main() 
{
  int a[100], b[100], m, n, c, sorted[200];

  printf("Input number of elements in first array\n");
  scanf("%d", &m);

  printf("Input %d integers\n", m);
  for (c = 0; c < m; c++)
 {
    scanf("%d", &a[c]);
  }

  printf("Input number of elements in second array\n");
  scanf("%d", &n);

  printf("Input %d integers\n", n);
  for (c = 0; c < n; c++) {
    scanf("%d", &b[c]);
  }

  merge(a, m, b, n, sorted);

  printf("Sorted array:\n");

  for (c = 0; c < m + n; c++)
 {
    printf("%d\n", sorted[c]);
  }

  return 0;
}

void merge(int a[], int m, int b[], int n, int sorted[]) 
{
  int i, j, k;

  j = k = 0;

  for (i = 0; i < m + n;) 
{
    if (j < m && k < n)
 {
      if (a[j] < b[k]) 
{
        sorted[i] = a[j];
        j++;
      }
      else {
        sorted[i] = b[k];
        k++;
      }
      i++;
    }
    else if (j == m) 
{
      for (; i < m + n;) 
{
        sorted[i] = b[k];
        k++;
        i++;
      }
    }
    else {
      for (; i < m + n;) 
{
        sorted[i] = a[j];
        j++;
        i++;
      }
    }
  }
}


OUTPUT





Change RadioButton Checked status on Button click in asp.net

<%@ Page Language="C#" %>  
  
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
  
<script runat="server">  
    protected void Button1_Click(object sender, System.EventArgs e)  
    {  
        RadioButton2.Checked = false;  
        RadioButton1.Checked = true;  
    }  
    protected void Button2_Click(object sender, System.EventArgs e)  
    {  
        RadioButton1.Checked = false;  
        RadioButton2.Checked = true;  
    }  
</script>  
  
<html xmlns="http://www.w3.org/1999/xhtml">  
<head id="Head1" runat="server">  
    <title>How to set, change RadioButton Checked status on Button click</title>  
</head>  
<body>  
    <form id="form1" runat="server">  
    <div>  
        <h2 style="color:Green">RadioButton Example: Checked OnClick</h2>  
        <asp:Label   
             ID="Label1"  
             runat="server"  
             Font-Bold="true"  
             ForeColor="Blue"  
             Text="Favorite Color?"  
             >  
        </asp:Label>  
        <br />  
        <asp:RadioButton   
             ID="RadioButton1"   
             runat="server"  
             Text="Gainsboro"  
             GroupName="Colors"  
             />  
        <asp:RadioButton   
             ID="RadioButton2"   
             runat="server"  
             Text="GoldenRod"  
             GroupName="Colors"  
             />  
        <br /><br />             
        <asp:Button   
             ID="Button1"   
             runat="server"   
             ForeColor="DarkMagenta"  
             Text="Checked RadioButton1"  
             OnClick="Button1_Click"  
             Font-Bold="true"  
             />  
        <asp:Button   
             ID="Button2"   
             runat="server"   
             Font-Bold="true"  
             ForeColor="DarkMagenta"  
             Text="Checked RadioButton2"  
             OnClick="Button2_Click"  
             />  
    </div>  
    </form>  
</body>  
</html>  

How to checked RadioButton on page load in asp.net

<%@ Page Language="C#" %>  
  
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
  
<script runat="server">  
    protected void page_Load(object sender, System.EventArgs e)  
    {  
        RadioButton2.Checked = true;  
    }  
</script>  
  
<html xmlns="http://www.w3.org/1999/xhtml">  
<head id="Head1" runat="server">  
    <title>How to checked RadioButton on page load</title>  
</head>  
<body>  
    <form id="form1" runat="server">  
    <div>  
        <h2 style="color:Red">RadioButton Example: Checked On Page Load</h2>  
        <asp:Label   
             ID="Label1"  
             runat="server"  
             Font-Bold="true"  
             ForeColor="Green"  
             Text="Favorite Color?"  
             >  
        </asp:Label>  
        <br />  
        <asp:RadioButton   
             ID="RadioButton1"   
             runat="server"  
             Text="LightGoldenRodYellow"  
             GroupName="Colors"  
             />  
        <asp:RadioButton   
             ID="RadioButton2"   
             runat="server"  
             Text="LightGray"  
             GroupName="Colors"  
             />  
    </div>  
    </form>  
</body>  
</html>  

Get RadioButton checked status programmatically in asp.net

<%@ Page Language="C#" %>  
  
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
  
<script runat="server">  
    protected void Button1_Click(object sender, System.EventArgs e)  
    {  
        if(RadioButton1.Checked == true)  
        {  
            Label1.Text = "Checked: " + RadioButton1.Text;  
        }  
        else if (RadioButton2.Checked == true)  
        {  
            Label1.Text = "Checked: " + RadioButton2.Text;  
        }  
        else  
        {  
            Label1.Text = "Checked None";  
        }  
    }  
</script>  
  
<html xmlns="http://www.w3.org/1999/xhtml">  
<head id="Head1" runat="server">  
    <title>How to get RadioButton checked status programmatically</title>  
</head>  
<body>  
    <form id="form1" runat="server">  
    <div>  
        <h2 style="color:Green">RadioButton Example: Checked Status</h2>  
        <asp:Label   
             ID="Label1"  
             runat="server"  
             Font-Bold="true"  
             ForeColor="Red"  
             Font-Size="Larger"  
             >  
        </asp:Label>  
        <br /><br />  
        <asp:Label   
             ID="Label2"  
             runat="server"  
             Font-Bold="true"  
             ForeColor="DodgerBlue"  
             Text="Favorite Color?"  
             >  
        </asp:Label>  
        <br />  
        <asp:RadioButton   
             ID="RadioButton1"   
             runat="server"  
             Text="GhostWhite"  
             GroupName="Colors"  
             />  
        <asp:RadioButton   
             ID="RadioButton2"   
             runat="server"  
             Text="Fuchsia"  
             GroupName="Colors"  
             />  
        <br /><br />             
        <asp:Button   
             ID="Button1"   
             runat="server"   
             ForeColor="DarkOliveGreen"  
             Text="Get Checked Status"  
             OnClick="Button1_Click"  
             Font-Bold="true"  
             />  
    </div>  
    </form>  
</body>  
</html>  

RadioButton OnCheckedChanged event in asp.net

<%@ Page Language="C#" %>  
  
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
  
<script runat="server">  
    protected void RadioButton_CheckedChanged(object sender, System.EventArgs e)  
    {  
        if (RadioButton1.Checked == true)  
        {  
            Label1.Text = "You choose: " + RadioButton1.Text;  
        }  
        else  
        {  
            Label1.Text = "You choose: " + RadioButton2.Text;  
        }  
    }  
</script>  
  
<html xmlns="http://www.w3.org/1999/xhtml">  
<head id="Head1" runat="server">  
    <title>How to use OnCheckedChanged event in RadioButton</title>  
</head>  
<body>  
    <form id="form1" runat="server">  
    <div>  
        <h2 style="color:Navy">RadioButton Example: OnCheckedChanged</h2>  
        <asp:Label   
             ID="Label1"  
             runat="server"  
             Font-Bold="true"  
             ForeColor="OliveDrab"  
             Font-Size="Large"  
             >  
        </asp:Label>  
        <br /><br />  
        <asp:Label   
             ID="Label2"  
             runat="server"  
             Font-Bold="true"  
             ForeColor="Crimson"  
             Text="Favorite Control?"  
             >  
        </asp:Label>  
        <br />  
        <asp:RadioButton   
             ID="RadioButton1"   
             runat="server"  
             Text="ValidationSummary"  
             GroupName="Controls"  
             OnCheckedChanged="RadioButton_CheckedChanged"  
             AutoPostBack="true"  
             />  
        <asp:RadioButton   
             ID="RadioButton2"   
             runat="server"  
             Text="CompareValidator"  
             GroupName="Controls"  
             OnCheckedChanged="RadioButton_CheckedChanged"  
             AutoPostBack="true"  
             />  
    </div>  
    </form>  
</body>  
</html>  

Unchecked RadioButton programmatically in asp.net

  1. <%@ Page Language="C#" %>  
  2.   
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
  4.   
  5. <script runat="server">  
  6.     protected void Page_Load(object sender, System.EventArgs e)  
  7.     {  
  8.         if(!this.IsPostBack)  
  9.         {  
  10.             RadioButton1.Checked = true;  
  11.         }  
  12.     }  
  13.     protected void Button1_Click(object sender, System.EventArgs e)  
  14.     {  
  15.         RadioButton1.Checked = false;  
  16.         RadioButton2.Checked = false;  
  17.     }  
  18. </script>  
  19.   
  20. <html xmlns="http://www.w3.org/1999/xhtml">  
  21. <head id="Head1" runat="server">  
  22.     <title>How to unchecked RadioButton programmatically</title>  
  23. </head>  
  24. <body>  
  25.     <form id="form1" runat="server">  
  26.     <div>  
  27.         <h2 style="color:Navy">RadioButton Example: Unchecked</h2>  
  28.         <asp:Label   
  29.              ID="Label1"  
  30.              runat="server"  
  31.              Font-Bold="true"  
  32.              ForeColor="Indigo"  
  33.              Text="Favorite Color?"  
  34.              >  
  35.         </asp:Label>  
  36.         <br />  
  37.         <asp:RadioButton   
  38.              ID="RadioButton1"   
  39.              runat="server"  
  40.              Text="LightBlue"  
  41.              GroupName="Colors"  
  42.              />  
  43.         <asp:RadioButton   
  44.              ID="RadioButton2"   
  45.              runat="server"  
  46.              Text="LightCoral"  
  47.              GroupName="Colors"  
  48.              />  
  49.         <br /><br />             
  50.         <asp:Button   
  51.              ID="Button1"   
  52.              runat="server"   
  53.              ForeColor="Indigo"  
  54.              Text="Unchecked RadioButton"  
  55.              OnClick="Button1_Click"  
  56.              Font-Bold="true"  
  57.              />  
  58.     </div>  
  59.     </form>  
  60. </body>  
  61. </html>  

Theme and skin id (SkinID) in asp.net RadioButton

//RadioButtonSkinID.aspx


<%@ Page Language="C#" Theme="Red" %>  
  
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
  
<script runat="server">  
      
</script>  
  
<html xmlns="http://www.w3.org/1999/xhtml">  
<head id="Head1" runat="server">  
    <title>How to use theme and skin id (SkinID) in RadioButton</title>  
</head>  
<body>  
    <form id="form1" runat="server">  
    <div>  
        <h2 style="color:Green">RadioButton Example: SkinID</h2>  
        <asp:Label   
             ID="Label1"  
             runat="server"  
             Font-Bold="true"  
             ForeColor="DarkBlue"  
             Text="Choose Favorite Color?"  
             >  
        </asp:Label>  
        <br />  
        <asp:RadioButton   
             ID="RadioButton1"   
             runat="server"  
             Text="DarkSeaGreen"  
             GroupName="Colors"  
             SkinID="DarkBlue"  
             />  
        <asp:RadioButton   
             ID="RadioButton2"   
             runat="server"  
             Text="DarkSlateBlue"  
             GroupName="Colors"  
             SkinID="DarkBlue"  
             />  
        <br /><br />  
        <asp:Label   
             ID="Label2"  
             runat="server"  
             Font-Bold="true"  
             ForeColor="DarkRed"  
             Text="Choose Favorite Control?"  
             >  
        </asp:Label>  
        <br />  
        <asp:RadioButton   
             ID="RadioButton3"   
             runat="server"  
             Text="RadioButtonList"  
             GroupName="Controls"  
             SkinID="Crimson"  
             />  
        <asp:RadioButton   
             ID="RadioButton4"   
             runat="server"  
             Text="ValidationSummary"  
             GroupName="Controls"  
             SkinID="Crimson"  
             />  
    </div>  
    </form>  
</body>  
</html>  

//Red.skin


<asp:RadioButton   
     SkinID="DarkBlue"   
     runat="server"  
     BackColor="DarkBlue"  
     Font-Size="X-Large"  
     Font-Italic="true"  
     Font-Underline="true"  
     ForeColor="AliceBlue"  
     />  
  
<asp:RadioButton   
     SkinID="Crimson"   
     runat="server"  
     BackColor="Crimson"  
     ForeColor="Snow"  
     Font-Size="Large"  
     BorderColor="DarkMagenta"  
     BorderWidth="2"  

     />  

American Standard Code for Information Interchange

SYMBOLS
VALUES
!
#
$
%
&
(
)
*
+
,
-
.
/
0
1
2
3
4
5
6
7
8
9
:
;
<
=
>
?
@
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
[
\
]
^
_
`
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
{
|
}
~
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126