Hello there Here we Will display all the data stored in database table in html.
For this example we use the Example code of

Php Program To Connect With Database, Create Table To Connect with database, create table and insert data to the database. And From this code below we can display the stored data.

Q.Write PHP code that retrieves all the districts from database in tabular format. Pokhara University [2012 -Spring] Course: Web Technology

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<!doctype html>
<html>
<head>
 <title>All the datas from Table in Database</title>
</head>
<body>
 <?php
 include "connect.php";
 $sql = "SELECT id,name,email FROM info";
 $result = $conn->query($sql);
 echo "<table border='1'>";
  echo "<tr>";
   echo "<th> Id </th>";
   echo "<th> Name </th>";
   echo "<th> Email </th>";
  echo "</tr>";
 while($row = $result->fetch_assoc()) { 
  echo "<tr>";
   echo "<td>" . $row["id"]. "</td>";
   echo "<td>" . $row["name"]. "</td>";
   echo "<td>" . $row["email"]. "</td>";
  echo "</tr>";
 }
 echo "<table>";
 ?>
</body>
</html>

Here is our info Table in Database:
Here is the Output of the Code Above

Id Name Email
1 Sagar Devkota info@devkotasagar.com.np
2 Ram Hari ram@hari.com.np
3 Mr Bean mr@bean.com.np
4 Cristiano Ronaldo Cristiano@Ronaldo.com.np
5 Tom Cruise tom@cruise.com.np
6 Raffey Cassidy Raffey@Cassidy.com.np

This is all. You can find the code in Github https://github.com/InfoDevkota/phpformmysql/tree/master (Master Branch) Issuers and pull requested are accepted.
If something is wrong or Need more clarification  Please contact me: info[at]devkotasagar.com.np.
Change the font size and color of the text using java script We use onmouseover in this example code. You can use onClick and onmouseout too.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<html>
<head>
 <title>Display a table</title>
</head>
<body>
 <p id="Hello" onmouseover="change(this)">Hello How are you doing</p>
 <script>
 function change(obj){
  obj.style.margin = "90px";
  obj.style.fontSize = obj.style.fontSize == "200%" ? "300%" : "200%";
  obj.style.color= obj.style.color=="green" ? "red" : "green"; 
 }
 </script>
</body>
</html>


Here is a Java Script to display a table. To display a table always remember to set table row in first loop and table data in second loop. The loop will horizontal as per in the table. So make the inner loop in such way that it will display data in next column. Though here is only one loop.


JavaScript Display Possibilities
  • JavaScript can "display" data in different ways:
  • Writing into an HTML element, using innerHTML.
  • Writing into the HTML output using document.write().
  • Writing into an alert box, using window.alert().
  • Writing into the browser console, using console.log().

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<html>
<head>
 <title>Display a table</title>
</head>
<body>
 <script>
 var i = 0;
 var j = 0;
 document.write("<table border='1'>");
  document.write("<tr>");
   document.write("<th> S.No </th>");
   document.write("<th> Input </th>");
   document.write("<th> Output </th>");
  document.write("</tr>");
 for(i=1;i<6;i++)
 {
  document.write("<tr>");
   document.write("<td>" + i + "</td>");
   document.write("<td>" + (i+4) + "</td>");
   document.write("<td>" + (i+4)*(i+4) + "</td>");
  document.write("</tr>");
 }
 document.write("</table>");
 </script>
</body>

For Better Understanding of the loops for table  in Java Script There is another Multiplication table below:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<html>
<head>
 <title>Display a table</title>
</head>
<body>
 <script>
 var i = 0;
 var j = 0;
 document.write("<table border='1'>");
        for(i=1;i<11;i++)
        {
          document.write("<tr>");
          for(j=1;j<11;j++)
          {
            document.write("<td>"+j+"*"+i+"="+(j*i)+"</td>");
          }
          document.write("</tr>");
        }
        document.write("</table>");
 </script>
</body>

As in the above loop we Use j*i Which makes the inner loop * outer loop as outer loop will changed as 10 inner loop so will display as 1*1=1 then in next row 2*1=2 ..... 10*1=10 Got it?
If something is wrong or Need more clarification  Please contact me: info[at]devkotasagar.com.np.
Hello There Here is a simple PHP Program to connect with MySQL database. Create a Table in the database and insert data into the database through the form.

Course: Web Technology
University: Pokhara University

Check The Internet and The Web – Introduction

Here is a connect.php file. We need Server, Database Name, Username and Password for that database.
new mysqli(server, username,password,database)
Will establish a database connection.

1
2
3
4
5
6
7
8
9
10
11
12
<?php
$server = "localhost";
$username ="test2";
$password ="test2";
$dbname ="test2";
$conn =new mysqli($server,$username,$password,$dbname);
if ($conn->connect_error)
{
  die("connection error " .$conn->connect_error);
}

 ?>

Here is createdb.php Which will create a table Named info with element name and email.
Here we save the SQL query in variable sql then run it in the Connection made above as
$conn -> query($sql)

1
2
3
4
5
6
7
8
<?php
include "connect.php";
$sql ="CREATE TABLE info(
  id INT(6) AUTO_INCREMENT PRIMARY KEY,
  name VARCHAR(60) NOT NULL,
  email VARCHAR(40) NOT NULL)";
$conn-> query($sql);
 ?>

Finally we are here in index.html, Here is a form with action test2.php. Whatever we send through this form will be send to test2.php (that is what action for)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title></title>
  </head>
  <body>
    <form class="" action="test2.php" method="post">
      Name: <input type="text" name="name" value="name"/><br>
      Email: <input type="email" name="email" value="email"/><br>
      <input type="submit" name="" value="send">

    </form>
  </body>
</html>

And here is test2.php which will get the values passed from the form and store them in the Database.
$_POST["name"] will get the value from the form with name name. The SQL query

INSERT INTO info(name, email) VALUES ('$name','$email')
Will insert the value of name and email to the table info and element name and email.
1
2
3
4
5
6
7
8
<?php
include "connect.php";
$name= $_POST["name"];
echo $_POST["name"];
$email = $_POST["email"];
$sql = "INSERT INTO info(name, email) VALUES ('$name','$email')";
$conn-> query($sql);
 ?>

This is all. You can find the code in Github https://github.com/InfoDevkota/phpformmysql/tree/master (Master Branch) Issuers and pull requested are accepted.
If something is wrong or Need more clarification  Please contact me: info[at]devkotasagar.com.np.
Aello This is a Simple JS Validation example Only to understand how it works.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<!doctype html>
<html>
 <head>
  <title>This is a Test JavaScript Validation page</title>
  <script>
   function check() {
    var x = document.forms["test"]["firstname"].value;
    var y = document.forms["test"]["email"].value;
    if (x == "") {
     document.getElementById('error').innerHTML = "Name must be Filled!";
     return false;
    }
    if (y == "") {
     document.getElementById('error').innerHTML = "Email must be Filled!";
     return false;
    }
    var at = y.indexOf("@");
    var dot = y.lastIndexOf(".");
    if (at < 1 || dot < 4 || at > dot ) {
     document.getElementById('error').innerHTML = "Enter a valid email";
     return false;
    }
   }
  </script>
 </head>
 <body>
  <form name="test" method="post" onsubmit = 'return check()'>
   <input type="text" name="firstname" placeholder="Enter a name"/>
   <input type="text" name="email" placeholder="Enter your mail"/>
   <input type="submit" value="Send"/>
  </form>
  <p id="error"></p>
 </body>
</html>

Hey that's not Aello! its Hello..
<Pokhara University CPP>
Functions and all types.
Constructor and Destructor
Friend Function
Operation Overloading
Type Conversion (All 3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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
#include<iostream>
using namespace std;
const double pi = 3.14; //If we try to alter the vaule of Pi compiler will generate a error.
class Test2;
class Test{
  int num1; //This will be in private section
  int num2; //This will be in private section
  public:
    //**************************Functions***************************//
    void add3(int a, int b, int c=5){ //Default arguments If only two args are pass last will take 5 if  all 3 are passed it will add those 3 numbers
      int add = a+b+c;
      cout<<"Sum = "<<add<<endl;
    }
    void add3(double a, double b, double c){ //Funtion Overloaded This function and above function name are same but if we pass int as arguments the above will be executed if float are passed this one will be executed
      double add = a+b+c;
      cout<<"Sum = "<<add<<endl;
    }
    void ifunction(){
      cout<<"I am a inline function"<<endl;
    } // FUnction definition inside class will be a inline function
    void anotherIFunc();// this is not a inline function as it is not defined here
    //**************************Constructor Destructor***************************//
    Test(){ //I am a default constructor
      num1=0;
      num2=0;
    }
    Test(int a, int b){ //I am a parameterised constructor
      num1=a;
      num2=b;
    }
    Test(Test &a){ //I am a copy constructor as i coppy the value of passed object to new object
      num1=a.num1;
      num2=a.num2;
    }
    //Here we use A function name Test to preform different taks, which is overload hence a constructor can be Overloaded
    ~Test(){ // Will be called automaticly Cannot be Overloaded as they takes no arguments
      cout<<"I am a Destructor"<<endl;
    }
    //**************************Friend Function***************************//
    friend void iaccess(Test a){//This is a friend function as there is keyword friend
      cout<<a.num2<<endl; // this can access the mamber data at private with a object.
      //no object is required to call a friend function.
    }
    friend void friendoftwo(Test a, Test2 b);
    //**************************Operator Overloading***************************//
    void operator -(){ //TO change the sign so a unary operator As this is unary operator we dont need to pass any args, as we will get a oject when it call
      num1 = num1*(-1);
      num2 = num2*(-1);
    }
    Test operator -(Test a){// TO subtract
      Test tmp;
      tmp.num1 = num1 - a.num1;
      tmp.num2 = num2 - a.num2;
      return tmp;
    }
    void display(){
      cout<<num1<<" and "<<num2<<endl;
    }
    //**************************Type Conversion***************************//
    Test(int a){ //Basic Type to Object Type Conversion
      num1=a;
      num2=a;
    }
    operator int (){ // Object to Basic Type conversion
      return num1+num2;
    }
    /* ******* DO YOU UNDERSTAND ******/ //YOU can OBtain the Object to Object Conversion by Defining constructor in Destination class or Operator conversion function in Source Class.
};
//*****************************************************//
class Test2{
  int age; //This will be in private section
  public:
    Test2(){
      age = 0;
    }
    friend void friendoftwo(Test a, Test2 b);
};
//*****************************************************//

inline void Test :: anotherIFunc(){ //Keyword "inline" makes it a inline function.
  cout<<"I am also a inline function"<<endl;
}

void friendoftwo(Test a, Test2 b){ //We dont need the friend keyword when defining the function.
  int tmp;
  cout<<a.num1<<" and "<<b.age<<endl;
  tmp = a.num1;
  a.num1= b.age;
  b.age = tmp; //Here we swap the private data of two classes using a friend function.
  cout<<a.num1<<" and "<<b.age<<endl;
}
int main()
{
  //Constructor and Function
  Test anum(2,10);
  anum.ifunction();
  anum.anotherIFunc();
  {
    //Destructor
    Test bnum;
    //Distructor will be automaticlly called when the program goes out of this "}"
  }
  //Friend Function
  iaccess(anum);
  Test2 bnum;//bnum.age is 0 because of the default constructor
  friendoftwo(anum, bnum);
  //Operator Overloading
  Test cnum(1,2);
  -cnum;
  cnum.display();
  Test add, dnum(7,15);
  add = dnum - anum;// Here the - FUnction is called by dnum and anum is passed as argument, as num1 is of dnum and a.num1 is of anum UNDERSTND THIS :) BE suer while using Greater then Operator.
  add.display();
  // Type conversion
  Test eanum;
  eanum = 9; //Both num1 and num2 gets the value of 9.
  eanum.display();
  int f = eanum; //f will get the value of num1+ num2 of eanum;
  cout<<f<<endl;

  return 0;
}

Is there anything Please do Comment, We will Update our Post Accordingly.
Q.Design a Soccer Player class that includes three integer fields: a player's Jersey number, number of goals, numbers of assists and necessary constructor to initialize the data members. Overload the ">" Operator (Greater than). One Player is considered greater if the sum of goals plus assists is greater than that of others. Create an array of 11 Soccer players, then use the overloaded ">" operator to ranks the players based on greatest goals plus assists.

Question for you:-
What is assists actually? Please answer in comment.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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
#include <iostream>
using namespace std;

class Soccer{
  int jNumber, goals, assists;
  public:
  Soccer(){
    jNumber = 0;
    goals = 0;
    assists = 0;
  };
  Soccer(int, int, int);
  bool operator > (Soccer &);
  void display();
};
Soccer :: Soccer(int j, int g, int a){
  jNumber = j;
  goals = g;
  assists = a;
}
bool Soccer :: operator > (Soccer &s){
  if(goals + assists > s.goals + s.assists){
    return true;
  }
  else{
    return false;
  }
}
void Soccer :: display(){
  cout << "Jersey Number: " << jNumber << endl;
  cout << " Goals: " << goals << endl;
  cout << " Assists: " << assists << endl;
}
int main(){
  int i,j, jn, goal, assist;
  Soccer tmp,S1[11];
  for(i = 0; i <= 2; i++){
    cout << "Enter Data For Player "<< i+1 << ":-" << endl;
    cout << "Jersey number:- ";
    cin >> jn;
    cout << "Goals:- ";
    cin >> goal;
    cout << "Assists:- ";
    cin >> assist;
    Soccer tmp(jn, goal, assist);
    S1[i] = tmp;
  }
  for( j = 0; j<=2; j++){
    for( i = j; i<=2; i++){
      if(S1[i] > S1[j])
      {
        tmp = S1[i];
        S1[i] = S1[j];
        S1[j] = tmp;
      }
    }
  }
  cout << "Best User Ranking:-"<<endl;
  for( i = 0; i<=2; i++){
    cout << i + 1 << ": " ;
    S1[i].display();
  }
  return 0;
}


Well First I overload the > operator to return a Boolean value (true if the first value is greater than second, else false) then I use a sorting algorithm to arrange the players.

If you are asked to select the Best player only. First take one player as reference and follow the sorting algorithm to assign the greater value to it. And display that player.
Thanks Pradeep :)

Here is the code by Nischal Lal Shrestha.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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
#include <iostream>
// #include <iostream.h>

using namespace std;

class Soccer_player{
   private:
   int jersey_number, number_of_goals, number_of_assists;
   string player_name;
   public:
   Soccer_player(){
      cout << "Enter Player Name: " << endl;
      cin >> player_name;
      cout << "Enter Jersey Number: " << endl;
      cin >> jersey_number;
      cout << "Enter Total Number of Goals: " << endl;
      cin >> number_of_goals;
      cout << "Enter Total Number of Assists: " << endl;
      cin >> number_of_assists;
      cout << "***** Player Info Updated *****" << endl;
   }

/* This is a copy constructor, 
We will used this to make another object called Best_Player
and first_player will be copied as best player for comparing it
with other(May we don't need this constructor )
*/

   Soccer_player(Soccer_player &Player){
      player_name = Player.player_name;
      jersey_number = Player.jersey_number;
      number_of_goals = Player.number_of_goals;
      number_of_assists = Player.number_of_assists;
    }

   void display(){
      cout << "Name: " << player_name << endl;
      cout << "Jersey Number: " << jersey_number << endl;
      cout << "Total Goals: " << number_of_goals << endl;
      cout << "Total Assists: " << number_of_assists << endl;
   }

   Soccer_player operator > (Soccer_player &P){
      if (number_of_assists + number_of_goals > P.number_of_assists + P.number_of_goals)
         return *this; // Return object which is already passed as default.
      else
         return P;
   }
};

int main(){
   Soccer_player Player[3];
   Soccer_player Best_Player = Player[0]; // First Player is made best player for comparision
   for(int i = 1; i < 3; ++i)
      Best_Player = Player[i] > Best_Player;
   cout << "\n\n\nOf all the info you updated\nThe Details of Best Player: \n\n" << endl;

   Best_Player.display();
   // getch();
   return 0;
}
Hello there, Here is a python code to convert what ever number you enter into words. First it will take a input. It wont ask with any message. Then it give back the number in words form. Here is no any code to handle unexpected user input. This program works for once to Hundred Billion.
Sample input:-
104382426112
Expected Output:-
One Hundred Four Billion Three Hundred Eighty Two Million Four Hundred Twenty Six Thousand One Hundred Twelve

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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
one = ['', 'One', 'Two', 'Three', 'Four', 'Five', 'Six', 'Seven', 'Eight', 'Nine']
tenp = ['Ten', 'Eleven', 'Twelve', 'Thirteen', 'Fourteen', 'Fifteen', 'Sixteen', 'Seventeen', 'Eighteen', 'Nineteen']
tenp2 = ['', '', 'Twenty', 'Thirty', 'Forty', 'Fifty', 'Sixty', 'Seventy', 'Eighty', 'Ninety']


def once(num):
    word = ''
    word = one[int(num)]
    word = word.strip()
    return word


def ten(num):
    word = ''
    if num[0] == '1':
        word = tenp[int(num[1])]
    else:
        text = once(num[1])
        word = tenp2[int(num[0])]
        word = word + " " + text
    word = word.strip()
    return word


def hundred(num):
    word = ''
    text = ten(num[1:])
    word = one[int(num[0])]
    if num[0] != '0':
        word = word + " Hundred "
    word = word + text
    word = word.strip()
    return word


def thousand(num):
    word = ''
    pref = ''
    text = ''
    length = len(num)
    if length == 6:
        text = hundred(num[3:])
        pref = hundred(num[:3])
    if length == 5:
        text = hundred(num[2:])
        pref = ten(num[:2])
    if length == 4:
        text = hundred(num[1:])
        word = one[int(num[0])]
    if num[0] != '0' or num[1] != '0' or num[2] != '0':
        word = word + " Thousand "
    word = word + text
    if length == 6 or length == 5:
        word = pref + word
    word = word.strip()
    return word


def million(num):
    word = ''
    pref = ''
    text = ''
    length = len(num)
    if length == 9:
        text = thousand(num[3:])
        pref = hundred(num[:3])
    if length == 8:
        text = thousand(num[2:])
        pref = ten(num[:2])
    if length == 7:
        text = thousand(num[1:])
        word = one[int(num[0])]
    if num[0] != '0' or num[1] != '0' or num[2] != '0' :
        word = word + " Million "
    word = word + text
    if length == 9 or length == 8:
        word = pref + word
    word = word.strip()
    return word


def billion(num):
    word = ''
    pref = ''
    text = ''
    length = len(num)
    if length == 12:
        text = million(num[3:])
        pref = hundred(num[:3])
    if length == 11:
        text = million(num[2:])
        pref = ten(num[:2])
    if length == 10:
        text = million(num[1:])
        word = one[int(num[0])]
    if num[0] != '0':
        word = word + " Billion "
    word = word + text
    if length == 12 or length == 11:
        word = pref + word
    word = word.strip()
    return word


# 104382426112 One Hundred Four Billion Three Hundred Eighty Two Million Four Hundred Twenty Six Thousand One HUndred Twelve

test = int(input())
a = str(test)
leng = len(a)
if leng == 1:
    if a == '0':
        num = 'Zero'
    else:
        num = once(a)
if leng == 2:
    num = ten(a)
if leng == 3:
    num = hundred(a)
if leng > 3 and leng < 7:
    num = thousand(a)
if leng > 6 and leng < 10:
    num = million(a)
if leng > 9 and leng < 13:
    num = billion(a)
print(num)

If you found it useful or if you are in need of it you can use it for any purpose. You can it extend to use for Trillion and so on.....

Define a class to represent a bank account. Include the following members:
  1. Data Members:
    1. Name of the account holder
    2. Account number
    3. Balance Amount in account
  2. Member Function:
    1. Open an account
    2. Deposit and Withdraw Fund
    3. Display account information
Write a program to test this class for 10 customers.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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
110
#include<iostream>
#include<stdio.h>
using namespace std;
class Bank
{
    char name[30];
    double accountno;
	double balance;
    public:
        Bank():balance(0){};
        void create_account(int a);
        void deposit();
        void withdraw();
        void display();
};
void Bank::create_account(int a)
{
    accountno=a;
    cout<<"* Enter Name:- ";
    cin>>name;
    cout<<"***********Account Successfully Created*******"<<endl;
    cout<<"* You Account no is:- "<<a<<endl;

}
void Bank::deposit()
{
	double add;
	cout<<"* Enter Deposite Value:- ";
    cin>>add;
    balance=add+balance;
    cout<<"***********Balance Successfully Deposited*******"<<endl;
}
void Bank::withdraw()
{
	double add;
	cout<<"* Enter Withdraw Value:- ";
    cin>>add;
    if(add<balance){
        cout<<"***********Balance Successfully Withdraw*******"<<endl;
        balance=balance-add;
    }else
        cout<<"***********Problem on Balance Withdraw (Balance Insufficent)*******"<<endl;
}

void Bank::display()
{
	cout<<"* Name:- "<<name<<endl;
    cout<<"* Account no.:- "<<accountno<<endl;
    cout<<"* Current Balance:- "<<balance<<endl;
}

int main()
{
	Bank A[10];
    int a,account,cnum=0;
    int b;
    cout<<"* * * * * * * * * * * * * * * * * * *"<<endl;
    do{
        cout<<"*\tSelect"<<endl<<"*\t1:- To Create Account"<<endl<<"*\t2:- To Deposite"<<endl<<"*\t3:- To Withdraw"<<endl<<"*\t4:- To View Details"<<endl<<"*\t5:- Exit the Program"<<endl<<"* ";
        cin>>a;
    switch(a){
        case 1:
      	{
      		cnum++;
            A[cnum].create_account(cnum);
            cout<<"* Do you want to Process again? (Enter 1 for Yes)";
            cin>>b;
            break;
     	 }
     	 case 2:
     	 {
            cout<<"* Enter Account no:- ";
            cin>>cnum;
            A[cnum].deposit();
            cout<<"* Do you want to Process again? (Yes=1 / NO=2)";
            cin>>b;
            break;
     	 }
     	 case 3:
      	{
      		cout<<"* Enter Account no:- ";
            cin>>cnum;
            A[cnum].withdraw();
            cout<<"* Do you want to Process again? (Yes=1 / NO=2)";
            cin>>b;
            break;
     	 }
     	 case 4:
      	{
            cout<<"* Enter Account no:- ";
            cin>>cnum;
            A[cnum].display();
            cout<<"* Do you want to Process again? (Yes=1 / NO=2)";
            cin>>b;
            break;
     	 }
     	 case 5:
      	{
      		cout<<"* Thanks For Using this Program";
            b = 2;
            break;
     	 }
     	 default:
     	 {
            cout<<"* Please Enter the Selected Option";
            b = 1;
     	 }
   	}
    }while(b == 1);
   return 0;
}

Here is the Output:-

Hello here is a short program to Pass pointer to array as an argument to a function and print the content of the function.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include<stdio.h>
void display (int *a)
{
 int i;
 for(i=0;i<10;i++)
 {
  printf("%d\n",*(a+i));
 }
}
void main()
{
 int data[10]={1,3,5,7,9,2,4,6,8,0};
 display(data);
}

Thats all!
Hello Here is a C program to Arrange Elements in an array Using Dynamic Memory allocation. Pointer.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include<stdio.h>
#include<stdlib.h>
main()
{
    int *p,n,j,i,tmp;
    printf("Enter the total no of Element to Arrange in:- ");
    scanf("%d",&n);
    p=(int *) malloc(sizeof(int)*n);
    printf("Enter the Emements:- \n");
    for (i=0;i<n;i++)
    {
        scanf("%d",(p+i));
    }
    for (i=0;i<(n-1);i++)
    {
        for(j=0;j<(n-i-1);j++)
        {
            if(*(p+j)>*(p+j+1))
            {
                tmp=*(p+j);
                *(p+j)=*(p+j+1);
                *(p+j+1)=tmp;
            }
        }
    }
    printf("Finally after arranged in Accesending Order:- \n");
    for (i=0;i<n;i++)
    {
        printf("%d \n",*(p+i));
    }
}

Have a good day!
Hello Here is a C Program to Find the Smallest Element among Array element. Here we use Dynamic Memory Allocation to Set the size of Array. And all other are as usual.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include<stdio.h>
#include<stdlib.h>
void main()
{
    int *p,n,i,min;
    printf("Enter the total number of elements:- ");
    scanf("%d",&n);
    p = (int *) malloc(sizeof(int) * n);
    printf("Enter the Elements of the Array:- \n");
    for(i=0;i<n;i++)
    {
        scanf("%d",(p+i));
    }
    min=*p;
    for(i=0;i<n;i++)
    {
        if(min>*(p+i))
        {
            min=*(p+i);
        }
    }
    printf("The Minimum ammong the Elements is %d",min);
}

p = (int *) malloc(sizeof(int) * n);
Here memory are allocated and the first memory is assigned to the first element.
Hello Here is C program to check If the year entered by user is century Year or not. First we check if the year is Century then check if it is leap or not. And for other check Leap year.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include<stdio.h>
main()
{
    int year;
    printf("Enter the Year you want to check:- ");
    scanf("%d",&year);
    if(year % 100 ==0)
    {
        if (year % 400 == 0)
        printf("Century Leap Year");
        else
        printf("Not a leap year");
    }
    else
    {
        if(year % 4 == 0)
        printf("Leap Year");
        else
        printf("Not a leap year");

    }
}

And I think you understand this code.
Hello here is a C program to Calculate the factorial and the square of the give number using Call by reference function.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include<stdio.h>
int ffact(int *);
int sqr(int *);

void main()
{
    int a,fact;
    printf("Enter the number:- ");
    scanf("%d",&a);
    fact=ffact(&a);
    printf("Factorial of the given number is %d\n",fact);
    fact=sqr(&a);
    printf("Square of that number is %d",fact);
}
int ffact(int *p)
{
    int i,fact=1;
    if(*p == 0)
        return 1;
    else
    for (i=1;i<=*p;i++)
    {
        fact=i*fact;
    }
    return (fact);
}
int sqr(int *p)
{
    int a;
    a = *p * *p;
    return (a);
}

And after code here is nothing I think I need to describe about.
Hello Here is a C program to Swap Two integer variable using call by reference.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include<stdio.h>
void swap (int *o, int *p)
{
    int tmp;
    tmp = *o;
    *o = *p;
    *p = tmp;
}
main ()
{
    int a,b;
    printf("Enter the value of A:- ");
    scanf("%d",&a);
    printf("Enter the value of B:- ");
    scanf("%d",&b);
    printf("\nBefore Swap:-\nA = %d\nB = %d",a,b);
    printf("\nAfter Swap:-");
    swap(&a, &b);
    printf("\nA = %d\nB = %d",a,b);
}


Hello Here is a C program to Print address and values at variables
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include<stdio.h>
void main()
{
    int a, *b;
    b = &a;
    printf("Enter the value of A:- ");
    scanf("%d",b);
    printf("\n(Indirect) Address of A = %u.\n", b);
    printf("(Direct) Address of A = %u.\n", &a);
    printf("(Pointer) Value of A = %d.\n", *b);
    printf("(Direct) Value of A = %d.\n", a);
    printf("(address operator) Value of A = %u.\n", *(&a));
    printf("Address of B = %u.\n", &b);
    printf("Value of B = %u.\n", b);
    printf("Value of B = %u.\n", *(&b));
}

Run the Program and check the code.
Hello Here is C Program to Find the Location (Place) of a Character That one Lies at Last.
Example: In Apple find P. Answer is 2. In Sagar Find a. Answer is 3. Else Not Found print no found.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include<stdio.h>
#include<conio.h>
void main()
 {
   char a,name[10];
   int i,the=0;
   printf("Enter String:- ");
   gets(name);
   printf("Enter Char:- ");
   scanf("%c",&a);
   for(i=0;name[i]!='\0';i++)
   the=the+1;
   for(i=the;i>=0;i--)
   {
    if(a==name[i])
    {
      printf("%d",i);
      break;
      }
   }
   if(i<0)
   printf("Not Found Sorry");
   getche();
   }

And First we find the total character and run the loop from Back and find the the character if found break the loop. else Display not found.
Hello Here is a C program to Swipe a Two Variables With out the use of other verifiable.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include<stdio.h>
void main()
    {
    int a,b;
    printf ("Enter the value of A:- ");
    scanf ("%d",&a);
    printf ("Enter the value of B:- ");
    scanf ("%d",&b);
    printf("%d is A and %d is B\n",a,b);
    a=a+b;
    b=a-b;
    a=a-b;
    printf("%d is A and %d is B\n",a,b);
    }

Let 4(a) 6(b)
4(a) + 6(b) = 10(a New)
10(a New) - 6(b) = 4(b New)
10(a New) - 4(b New) = 6(a New)

I expect you understand the code above.
Hello Here i a c Program for matrix multiplication of User defined size. Here we create different function to Read data add the data and display them.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
52
#include<stdio.h>
void read(int,int,int [][20]);
void add(int,int,int [][20],int [][20],int [][20]);
void display(int,int,int [][20]);
void main()
    {
    int r,c,mat[20][20],sem[20][20],sum[20][20];
    printf("Enter the Value of Row and Column:- \n");
    scanf("%d %d",&r, &c);
    printf("Enter the First Matrix:- \n");
    read(r,c,mat);
    printf("Enter the Second Matrix:- \n");
    read(r,c,sem);
    add(r,c,mat,sem,sum);
    printf("The Sum matrix is:- \n");
    display(r,c,sum);
    }
void read(int x,int y,int ma[20][20])
    {
    int i,j;
    for (i=0;i<x;i++)
        {
        for(j=0;j<y;j++)
            {
            scanf("%d",&ma[i][j]);
            }
        }
    }
void add(int x, int y,int right[20][20],int left[20][20],int ans[20][20])
    {
    int i,j;
    for (i=0;i<x;i++)
        {
        for(j=0;j<y;j++)
            {
            ans[i][j]=right[i][j]+left[i][j];
            }
        }
    }
void display(int x,int y, int ma[20][20])
    {
    int i,j;
    for (i=0;i<x;i++)
        {
        for(j=0;j<y;j++)
            {
            printf("%d\t",ma[i][j]);
            }
        printf("\n");
        }
    }

The Process is Quite simple in add function we pass 3 matrix so that can store the sum in one of the matrix and display it.
Hello Write some things here
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include<stdio.h>
void read(int, int []);
void display(int, int []);
void sort(int, int []);
void main()
    {
    int num, data[50];
    printf("Enter Total no of value to be sorted in Accessending Order:- ");
    scanf("%d",&num);
    read(num, data);
    sort(num, data);
    printf("After SUcessful Arangement in Accessending Order:- \n");
    display(num,data);
    }
void read(int x, int thedata[50])
    {
    int i;
    printf("Enter the values to be inserted in the array:-\n");
    for(i=0;i<x;i++)
        {
        scanf("%d",&thedata[i]);
        }
    }
void sort(int x, int thedata[50])
    {
    int i,j,tmp;
    for(i=0;i<x-1;i++)
        {
        for (j=0;j<x-1;j++)
            {
            if(thedata[j]>thedata[j+1])
                {
                tmp=thedata[j];
                thedata[j]=thedata[j+1];
                thedata[j+1]=tmp;
                }
            }
        }
    }
void display(int x, int thedata[50])
    {
    int i;
    for(i=0;i<x;i++)
        {
        printf("%d\t",thedata[i]);
        }
    }

Here we Use a function to read another to sort and another to display. As passing array is call by reference we need not to return individual value.
Hello Read a String from Users and Print It in Multi line using new line after every words. Read a String "my name is sagar Devkota" and Print it as:-
My
Name
Is
Sagar
Devkota

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include<stdio.h>
void nline(char []);
void main()
    {
    char asent[100];
    int i;
    printf("Enter a line of string:- \n");
    gets(asent);
    nline(asent);
    puts(asent);

    }
void nline(char thesent[100])
    {
    int i;
    for (i=0;thesent[i]!='\0';i++)
        {
        if (thesent[0]>='a' && thesent[0]<='z')
            thesent[0]=thesent[0]-32;
        if(thesent[i]==' ')
            {
                thesent[i]='\n';
                if(thesent[i+1]>='a' && thesent[i+1]<='z')
                    thesent[i+1]=thesent[i+1]-32;
            }
        }
    }

Here we Check the case of First and make it capital if it was small. Then check every space and replace it with Newline "\n". and Make Capital all after that space.
Hello Here is a program to count the UPPERCASE lowercase and Total Characters in a String.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include<stdio.h>
#define MAX 100
int ucase(char asent[]);
int lcase(char asent[]);
int total(char asent[]);
void main()
    {
    int u,l,t;
    char asent[MAX];
    printf("Enter a Sentence:-\n");
    gets(asent);
    u=ucase(asent);
    l=lcase(asent);
    t=total(asent);
    printf("In the Sentence ");
    puts(asent);
    printf("Total Letters are %d. Among them %d are UPPERCASE and %d are lowercase",t,u,l);
    }
int ucase(char thesent[MAX])
    {
    int i,count=0;
    for (i=0;thesent[i]!='\0';i++)
        {
        if(thesent[i]>='A' && thesent[i]<='Z')
        count++;
        }
    return (count);
    }
int lcase(char thesent[MAX])
    {
    int i,count=0;
    for (i=0;thesent[i]!='\0';i++)
        {
        if(thesent[i]>='a' && thesent[i]<='z')
        count++;
        }
    return (count);
    }
int total(char thesent[MAX])
    {
    int i,count=0;
    for (i=0;thesent[i]!='\0';i++)
        {
        count++;
        }
    return (count);
    }

We pass the string and Check their case and increment if they are with in the boundary.
Hello Here is A program to Print the Prime Number up to That Number which is inserted by users. Here we are using function. If you are not using function yet You can read the number in second function and process.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include<stdio.h>
void prime(int);
void main()
    {
    int num;
    printf("Enter a Number up to which the prime numbers to be printed:- ");
    scanf("%d",&num);
    prime(num);
    }
void prime(int a)
    {
    int i,j;
    printf("1\t2\t");
    for (i=3;i<=a;i++)
        {
        for (j=2;j<i;j++)
            {
            if ((i%j)==0)
            break;
            }
        if(i==j)
        printf("%d\t",i);
        }
    }

Here we ask users for the max number up to which we need to print out the prime number and from there. we Pass that value to The function and Display the value.
Hello this is a program to convert a Line string to multyline by inserting newline in every space and Capatalize the first word of all line.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include<stdio.h>
void main()
    {
    char asent[100];
    int i;
    printf("Enter a line of string:- \n");
    gets(asent);
    puts(asent);
    for (i=0;asent[i]!='\0';i++)
        {
        if (asent[0]>='a' && asent[0]<='z')
            asent[0]=asent[0]-32;
        if(asent[i]==' ')
            {
                asent[i]='\n';
                if(asent[i+1]>='a' && asent[i+1]<='z')
                    asent[i+1]=asent[i+1]-32;
            }
        }
    puts(asent);

    }

Write a program to Read the string "My name is sagar devkota" and convert it in the following form using loop:-
My
Name
Is
Sagar
Devkota

Here in the above program we check the Case of first word and make it capital if needed and check every space and replace it with newline and check the case of next word and change its case to Uppercase and display at last.
Hello Here is a program to convert A string inserted from users to lower case.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include<stdio.h>
void main()
{
char cname[100];
int i;
printf("Enter the name of your collage:-\n");
gets(cname);
for (i=0;cname[i]!='\0';i++)
    {
    if(cname[i]>='A' && cname[i]<='Z')
        cname[i]=cname[i]+32;
    }
puts(cname);
}

Here the program checks every alphabet if they are Upper case it will change all of them into lowercase else they will be as it is.
Hello Here is a C program for matrix multiplication of  size 3*3 Using function. This is the easiest process. From this code concept you can make multiplication of any size of matrix too. Just need to add some tmp locations.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
46
47
48
49
50
51
#include <stdio.h>
#include <stdlib.h>
void mult(int [][3],int [][3],int [][3]);
//Program for Multiplication of matrix 3*3 Time and Update
int main()
{
    int a[3][3],b[3][3],c[3][3];
    int i,j;
    printf("Enter value of matrix A \n");
    for(i=0;i<3;i++)
    {
        for(j=0;j<3;j++)
            scanf("%d",&a[i][j]);
        printf("\n");
    }
    printf("Enter value of matrix B \n");
    for(i=0;i<3;i++)
    {
        for(j=0;j<3;j++)
            scanf("%d",&b[i][j]);
        printf("\n");
    }
    mult (a,b,c);
    printf("https://timeandupdate.com \n");
    printf("The Multiplication is :-\n");
    for(i=0;i<3;i++)
    {
        for(j=0;j<3;j++)
            printf("%d\t",c[i][j]);
        printf("\n");
    }
    return 0;
}
void mult(int x[][3],int y[][3],int z[][3])
{
    int i,j,tmp1=0,tmp2=0,tmp3=0;
    for(i=0;i<3;i++)
    {
        for(j=0;j<3;j++)
        {
            tmp1=x[i][j]*y[j][0]+tmp1;
            tmp2=x[i][j]*y[j][1]+tmp2;
            tmp3=x[i][j]*y[j][2]+tmp3;
        }
        z[i][0]=tmp1;
        z[i][1]=tmp2;
        z[i][2]=tmp3;

    }
}

Here is the Output:
I did not check all but looks its correct.


The above program is compiled and successfully run on Code::Block 13.12.
This is easy program but you just need to focus. If you cant understand how this program flow don't forget to comment we will be back to help you.
Hello Here is a C program for matrix multiplication of  size 3*3. This is the easiest process. From this code concept you can make multiplication of any size of matrix too. Just need to add some tmp locations.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include <stdio.h>
#include <stdlib.h>
//Program for Multiplication of matrix 3*3 Time and Update
int main()
{
    int a[3][3],b[3][3],c[3][3];
    int i,j,k,tmp1=0,tmp2=0,tmp3=0;
    printf("Enter value of matrix A \n");
    for(i=0;i<3;i++)
    {
        for(j=0;j<3;j++)
            scanf("%d",&a[i][j]);
        printf("\n");
    }
    printf("Enter value of matrix B \n");
    for(i=0;i<3;i++)
    {
        for(j=0;j<3;j++)
            scanf("%d",&b[i][j]);
        printf("\n");
    }
    for(i=0;i<3;i++)
    {
        for(j=0;j<3;j++)
        {
            tmp1=a[i][j]*b[j][0]+tmp1;
            tmp2=a[i][j]*b[j][1]+tmp2;
            tmp3=a[i][j]*b[j][2]+tmp3;
        }
        c[i][0]=tmp1;
        c[i][1]=tmp2;
        c[i][2]=tmp3;

    }
    printf("https://timeandupdate.com \n");
    printf("The Multiplication is :-\n");
    for(i=0;i<3;i++)
    {
        for(j=0;j<3;j++)
            printf("%d\t",c[i][j]);
        printf("\n");
    }
    return 0;
}

Here is the Output:
I did not check all but looks its correct.


The above program is compiled and successfully run on Code::Block 13.12.
This is easy program but you just need to focus. If you cant understand how this program flow don't forget to comment we will be back to help you.
Hello Here is A c program to arrange numerical data in array in ascending order (1 3 8..). Input N numbers means you need to ask users how much numbers to be inserted. Here we are using max 10 Numbers if you need more you can from Changing the value a[10]. what ever you need. And you should change it in Called function too.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include<stdio.h>
#include<conio.h>
void asce(int[],int);
void main()
 {
    int a[10],n,i;
      printf("Enter total no of array to be inserted in array:- ");
      scanf("%d",&n);
      printf("Enter value to be inserted in array");
      for(i=0;i<n;i++)
         scanf("%d",&a[i]);
      asce(a,n);
      printf("After arrranging in ascending order:- \n");
      for(i=0;i<n;i++)
         printf("%d\t",a[i]);
      getche();
   }
void asce(int a[10],int y)
 {
    int i,j,tmp;
      for (i=0;i<y;i++)
      {
       for(j=0;j<y-1;j++)
          {
             if(a[j]>a[j+1])
                {
                   tmp=a[j+1];
                   a[j+1]=a[j];
                   a[j]=tmp;
                  }
            }
      }
   }

The main concept is the nested for loop. There are 100s ways to perform a program. The return type of called function is void as value is passed by reference.