Categories
Ruby

Power of a Number in Ruby

 Design and create a program that will ask the user to give base and exponent values and then the program will compute the power value of the number and then display the result on the screen.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following [email protected], [email protected], and [email protected]

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod City I also accepting computer repair, networking, and Arduino Project development at a very affordable price. My website is www.jakerpomperada.blogspot.com and www.jakerpomperada.com

If you like this video please click the LIKE button, SHARE, and SUBSCRIBE to my channel.

Your support on my channel is highly appreciated.

Thank you very much.

Program Listing

# power.rb
# Written By Mr. Jake Rodriguez Pomperada,BSCS,MAED-IT
# Tools : Ruby 2.6.3 and Sublime Text Editor 
# May 13, 2019    Monday   9:48 PM
# Bacolod City, Negros Occidental
# Website       : http://www.jakerpomperada.com
# Email Address : [email protected]

puts "\n\n"
print "\tPower of a Number in Ruby";
puts "\n\n"
print "\tEnter a Base Number : ";
base = gets;
print "\tEnter an Exponent   : ";
exponent = gets;

base = base.to_i;
exponent = exponent.to_i;

solve_power = (base ** exponent);

print "\n\n";
print "\tDISPLAY RESULTS";
print "\n\n";
print "\t#{base} ^ #{exponent} = #{solve_power}";
puts "\n\n";
print "\tEnd of Program";
puts "\n";
Categories
Ruby

Greetings Program in Ruby

 Write a program that will ask the user to give its first name and last name and then the program will greet the person.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following [email protected], [email protected], and [email protected]

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod City I also accepting computer repair, networking, and Arduino Project development at a very affordable price. My website is www.jakerpomperada.blogspot.com and www.jakerpomperada.com

If you like this video please click the LIKE button, SHARE, and SUBSCRIBE to my channel.

Your support on my channel is highly appreciated.

Thank you very much.

Program Listing


# greet.rb
# Author   : Jake Rodriguez Pomperada,BSCS,MAED-IT
# Date     : May 10, 2019     Friday
# Address  : Bacolod City, Negros Occidental
# Tools    : Sublime Text and Ruby Version 2.6.3
# Location : Bacolod City, Negros Occidental	
# Website  : http://www.jakerpomperada.com
# Emails   : [email protected] and [email protected]

print "\n\n";
print "\tGreetings Program";
print "\n\n";
print "\tGive your First Name : "
fname = gets.chomp
print "\n";
print "\tGive your Last Name  : "
lname = gets.chomp
print "\n\n";
print "\tHello #{fname.upcase} #{lname.upcase}.";
print "\n\n";
print "\tWelcome to Ruby Programming.";
print "\n\n";
print "\tEnd of Program";
print "\n";
Categories
VB.NET

US Dollar To Philippine Peso Converter in Visual Basic.NET

Here is a simple program that I wrote using Microsoft Visual Basic NET to ask the user to give an amount in US Dollars and then it will convert into Philippine Peso equivalent. Let us assume that one US Dollar is equivalent to Php 45.50 in Philippine Pesos. The code is very easy to understand I started learning Visual Basic NET in my spare time.
Add me at Facebook my address is [email protected] and [email protected]
My email address are the following [email protected] and [email protected]
My mobile number here in the Philippines is 09173084360.

Program Listing

Public Class Form1

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim compute_peso As Double
        compute_peso = (Val(TextBox1.Text) * 45.5)
        Label3.Text = "The Philippine Peso Rate is Php " & Format(compute_peso, "0.00")
    End Sub

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        TextBox1.Text = ""
        Label3.Text = ""
        TextBox1.Focus()
    End Sub

    Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
        Dim result As DialogResult = MessageBox.Show("Do you want to quit?", _
                               "Quit Program", _
                               MessageBoxButtons.YesNo)

        If (result = DialogResult.Yes) Then
            End
        Else
            TextBox1.Text = ""
            Label3.Text = ""
            TextBox1.Focus()
        End If
    End Sub
End Class
Categories
Java

Multiple Choice Trivia Quiz in Java

 I wrote this simple multiply choice trivia quiz using Java programming language that shows how to use control statements, arrays, and methods in Java.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following [email protected], [email protected], and [email protected]

My mobile number here in the Philippines is 09173084360.

Program Listing


/**
 * @author Jake Rodriguez Pomperada, MAED-IT, MIT
 * [email protected]
 * www.jakerpomperada.com  / www.jakerpomperada.blogspot.com
 * Bacolod City, Negros Occidental, Philippines
 * January 25, 2021  Monday
 */

import java.util.Scanner;

public class Multiple_Choice_Quiz {    
   
 static Scanner Input = new Scanner(System.in);
 
 public static void display_program() {
	 
	   int correct = 0;

       int incorrect=0;

      int questions = 5;

      System.out.print("\n");
      System.out.println("Multiple Choice Trivia Quiz in Java");

      System.out.print("\n");

       String[][] Ques_Ans = {

{"What game was created by Markus Persson in the Java programming language?","\n A. Pacman \n B. Minecraft \n C. Starcraft \n D. Battle City\n","B"},

{"What nba team Lebron James wins his 4th Championship ring? ","\n A. Chicago Bulls \n B. New York Knicks \n C. LA Lakers \n D. Boston Celtics\n","C"},

{"Who is the present President of the Philippines? ","\n A. Gloria Arroyo \n B. Rody Duterte \n C. Fidel Ramos \n D. Noynoy Aquino\n","B"},

{"Who is the founder of Microsoft? ","\n A. Bill Allen \n B. Peter Norton \n C. Bill Gates \n D. Mark Cuban\n","C"},

{"What NBA Team Tim Duncan played?","\n A. San Antonio Spurs \n B. Toronto Raptors \n C. Detriot Piston \n D. Booklyn Nets\n","A"}};



      String[] user_ans = new String[(int) questions];

      int i=0;

       

      do {

          System.out.print("" + (i+1) + ". " + Ques_Ans[i][0] + "   "+Ques_Ans[i][1]);

          user_ans[i] = String.valueOf(Input.next().charAt(0));

       
   
          if(Ques_Ans[i][2].equals(user_ans[i].toUpperCase())) {

              System.out.println("\n Correct Answer!");

               correct++; 
              

          }

          else

          {

              System.out.println("\n Incorrect. The correct answer is "+Ques_Ans[i][2]);

              incorrect++;

          }

          System.out.print("\n");

          i++;

     }while(i<questions);                      

      System.out.print("\n");
      System.out.print("\t===== DISPLAY RESULTS =====");
      System.out.print("\n");
      System.out.println("\n Number of correct answers: "+ correct);
      System.out.println("\n Number of incorrect answers: "+ incorrect);
      System.out.print("\n");
      System.out.print("\tEnd of Program");
      System.out.print("\n");
      System.exit(0);

 }

    public static void main(String[] args){
    
    	display_program();
        
    }



}
Categories
Ruby

Parameter and Area of the Circle Solver in Ruby

Write a program that accepts the radius of a circle from the user and compute the parameter and area

and display the result on the screen using Ruby programming language.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following [email protected], [email protected], and [email protected]

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod City I also accepting computer repair, networking, and Arduino Project development at a very affordable price. My website is www.jakerpomperada.blogspot.com and www.jakerpomperada.com

If you like this video please click the LIKE button, SHARE, and SUBSCRIBE to my channel.

Your support on my channel is highly appreciated.

Thank you very much.

Program Listing

# area_circle.rb
# Author   : Jake Rodriguez Pomperada,BSCS,MAED-IT
# Date     : May 10, 2019     Friday
# Address  : Bacolod City, Negros Occidental
# Tools    : Sublime Text and Ruby Version 2.6.3
# Location : Bacolod City, Negros Occidental	
# Emails   : [email protected] and [email protected]
radius = 5.00;
perimeter = 0.00;
area = 0.00;

print "\n\n";
print "\tParameter and Area of the Circle Solver";
print "\n\n";
print "\tRadius of the circle: ";

radius = gets.to_f
perimeter = 2 * 3.141592653 * radius;
area = 3.141592653 * radius * radius;

print "\n";
print "\tDISPLAY RESULTS"
print "\n\n";
puts "\tThe perimeter is %.2f of the circle." % perimeter
print "\n";
puts "\tThe area is %.2f of the circle." % area
print "\n";
print "\tEnd of Program";
print "\n";

Categories
C++

General Average of Three Grading Period in C++

 Machine Problem in C++

Design a program that generates the general average of three grading systems. Display the remarks as output,based on the following given scale.

General Average    Equivalent Grade   Remarks

100-97             1.0                EXCELLENT

96-94              1.25               EXCELLENT

93-91              1.50               VERY GOOD

90-88              1.75               VERY GOOD

87-85              2.0                GOOD

84-82              2.25               GOOD

81-79              2.5                SATISFACTORY

76-78              2.75               FAIR

75                 3.0                PASSED

BELOW 75           5.0                FAILED 

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following [email protected], [email protected], and [email protected]

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod City I also accepting computer repair, networking, and Arduino Project development at a very affordable price. My website is www.jakerpomperada.blogspot.com and www.jakerpomperada.com

If you like this video please click the LIKE button, SHARE, and SUBSCRIBE to my channel.

Your support on my channel is highly appreciated.

Thank you very much.

Program Listing

/* general_average.cpp

Machine Problem in C++

Design a program that generates the general average of three
grading systems. Display the remarks as output,based on the
following given scale.

General Average Equivalent Grade Remarks
100-97 1.0 EXCELLENT
96-94 1.25 EXCELLENT
93-91 1.50 VERY GOOD
90-88 1.75 VERY GOOD
87-85 2.0 GOOD
84-82 2.25 GOOD
81-79 2.5 SATISFACTORY
76-78 2.75 FAIR
75 3.0 PASSED
BELOW 75 5.0 FAILED

/* general_average.cpp

Machine Problem in C++

Design a program that generates the general average of three
grading systems. Display the remarks as output,based on the 
following given scale.

General Average    Equivalent Grade   Remarks
100-97             1.0                EXCELLENT
96-94              1.25               EXCELLENT
93-91              1.50               VERY GOOD
90-88              1.75               VERY GOOD
87-85              2.0                GOOD
84-82              2.25               GOOD
81-79              2.5                SATISFACTORY
76-78              2.75               FAIR
75                 3.0                PASSED
BELOW 75           5.0                FAILED 


Author     : Jake Rodriguez Pomperada, MAED-IT, MIT
Tools      : Dev C++ 
Websites   : www.jakerpomperada.com    www.jakerpomperada.blogspot.com
Email      : [email protected]
Location   : Bacolod City, Negros Occidental, Philippines

*/


#include <iostream> 
#include <iomanip>
#include <string>


int main()
{
	std::string remarks;
	int prelim=0,midterm=0,endterm=0;
	int general_average=0;
	float equiv_grade=0;
	

	std::cout << "\n\n";
	std::cout << "\tGeneral Average of Three Grading Period in C++";
	std::cout << "\n\n";
	std::cout << "\tEnter Prelim Grade  : ";
	std::cin >> prelim;
	std::cout << "\tEnter Midterm Grade : ";
	std::cin >> midterm;
	std::cout << "\tEnter Endterm Grade : ";
	std::cin >> endterm;
	
	 general_average = (prelim+midterm+endterm)/3;
	 
	 
	if (general_average>= 97 && general_average <= 100) {
		 equiv_grade = 1.0;
		 remarks = "EXCELLENT";
	} else if (general_average>= 94 && general_average <= 96) {
		 equiv_grade = 1.25;
		 remarks = "EXCELLENT";
	} else if (general_average>= 91 && general_average <= 94) {
		 equiv_grade = 1.50;
		 remarks = "VERY GOOD";
	} else if (general_average>= 88 && general_average <= 90) {
		 equiv_grade = 1.75;
		 remarks = "VERY GOOD";
	} else if (general_average>= 85 && general_average <= 87) {
		 equiv_grade = 2.0;
		 remarks = "GOOD";
	} else if (general_average>= 82 && general_average <= 84) {
		 equiv_grade = 2.25;
		 remarks = "GOOD";
	} else if (general_average>= 79 && general_average <= 81) {
		 equiv_grade = 2.25;
		 remarks = "SATISFACTORY";
	} else if (general_average>= 76 && general_average <= 78) {
		 equiv_grade = 2.75;
		 remarks = "FAIR";
	}else if (general_average>= 75) {
		 equiv_grade = 3.0;
		 remarks = "FAIR";
	} else {
		 equiv_grade = 5.0;
		 remarks = "FAILED";
	}
	
	std::cout << "\n\n";
	std::cout <<"\tGeneral Average Grade  :  " <<general_average <<"\n";
	std::cout <<"\tEquivalent Grade       :  " 
	 << std::setprecision(3) << equiv_grade <<"\n";
    std::cout << std::fixed << std::showpoint;
	std::cout <<"\tGrade Remarks          :  " <<remarks;
	std::cout << "\n\n";
	std::cout << "\tEnd of Program";
	std::cout << "\n\n";
}

Categories
C++

Philippine Peso to Other Currencies in C++

Machine Problem in C++

 In this tutorial I wrote this program to ask the user  to give Philippine Peso value and convert it to other

 currencies like  hongkong dollar, uae derham, us dollar,   and japanese yen.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following [email protected], [email protected], and [email protected]

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod City I also accepting computer repair, networking, and Arduino Project development at a very affordable price. My website is www.jakerpomperada.blogspot.com and www.jakerpomperada.com

If you like this video please click the LIKE button, SHARE, and SUBSCRIBE to my channel.

Your support on my channel is highly appreciated.

Thank you very much.

/* php_peso.cpp


 Machine Problem in C++

 In this tutorial I wrote this program will ask the user
 to give Philippine Peso value and convert it to other
 currencies like  hongkong dollar, uae derham, us dollar, 
 and japanese yen.
 

 Mr. Jake Rodriguez Pomperada,MAED-IT, MIT
 www.jakerpomperada.com
 www.jakerpomperada.blogspot.com
 [email protected]
 Bacolod City, Negros Occidental Philippines.

 */

#include <iostream>
#include <iomanip>
 

 int main()

 {

 	float php_peso = 0.00;
 	float hk_dollar = 0.00, uae_dirham = 0.00;
 	float us_dollar = 0.00, jpn_yen = 0.00;

 	std::cout <<"\n\n";
 	std::cout <<"\tPhilippine Peso to Other Currencies in C++";
	std::cout <<"\n\n";
 	std::cout <<"\tGive Philippine Peso Value : ";
    std::cin >> php_peso;
 	std::cout <<"\n\n";

 	hk_dollar = (php_peso * 0.16137);
    uae_dirham = (php_peso * 0.07646);
    us_dollar = (php_peso * 0.02081);
    jpn_yen =   (php_peso* 2.1612);

   	std::cout <<"\tHong Kong Dollar :  " 
	 << std::setprecision(3) << hk_dollar <<"\n";
	std::cout << std::fixed << std::showpoint;
 	std::cout <<"\tUAE Dirham       :  " << std::setprecision(3) 
	 <<uae_dirham <<"\n"; 
	 	std::cout << std::fixed << std::showpoint;
	std::cout <<"\tUS Dollar        :  " << std::setprecision(3) 
	<< us_dollar <<"\n";
		std::cout << std::fixed << std::showpoint;
	std::cout <<"\tJapanese Yen     :  " << std::setprecision(3) 
	<< jpn_yen <<"\n"; 
		std::cout << std::fixed << std::showpoint;
	std::cout <<"\n\n";
 	std::cout <<"\tEnd of Program";
 } // End Code
Categories
C

Philippine Peso to Other Currencies in C

Machine Problem in C

 In this tutorial I wrote this program to ask the user  to give Philippine Peso value and convert it to other

 currencies like  hongkong dollar, uae derham, us dollar,  and japanese yen.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following [email protected], [email protected], and [email protected]

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod City I also accepting computer repair, networking, and Arduino Project development at a very affordable price. My website is www.jakerpomperada.blogspot.com and www.jakerpomperada.com

If you like this video please click the LIKE button, SHARE, and SUBSCRIBE to my channel.

Your support on my channel is highly appreciated.

Thank you very much.

Program Listing


/* php_peso.c

 Machine Problem in C
   
 In this tutorial I wrote this program to ask the user
 to give Philippine Peso value and convert it to other
 currencies like  hongkong dollar, uae derham, us dollar, 
 and japanese yen.
 
 Mr. Jake R. Pomperada,MAED-IT, MIT
 www.jakerpomperada.com
 www.jakerpomperada.blogspot.com
 [email protected]
 Bacolod City, Negros Occidental Philippines.
 */
 
 
 #include <stdio.h>
 
 int main()
 {
 	float php_peso = 0.00;
 	float hk_dollar = 0.00, uae_dirham = 0.00;
 	float us_dollar = 0.00, jpn_yen = 0.00;
 	
 	printf("\n\n");
 	printf("\tPhilippine Peso to Other Currencies in C");
 	printf("\n\n");
 	printf("\tGive Philippine Peso Value : ");
 	scanf("%f", &php_peso);
 	printf("\n\n");
 	
 	hk_dollar = (php_peso * 0.16137);
    uae_dirham = (php_peso * 0.07646);
    us_dollar = (php_peso * 0.02081);
    jpn_yen =   (php_peso* 2.1612);

 	printf("\tHong Kong Dollar : %5.2f\n ",hk_dollar);
 	printf("\tUAE Dirham       : %5.2f\n ",uae_dirham); 
 	printf("\tUS Dollar        : %5.2f\n ",us_dollar);
 	printf("\tJapanese Yen     : %5.2f\n ",jpn_yen); 
 	printf("\n\n");
 	printf("\tEnd of Program");
 }
 
Categories
C++

Selection Sort in C++

 Machine Problem in C++

Write a program to ask the user to give a series of numbers and then the program will sort the given numbers using selection sort algorithms.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following [email protected], [email protected], and [email protected]

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod City I also accepting computer repair, networking, and Arduino Project development at a very affordable price. My website is www.jakerpomperada.blogspot.com and www.jakerpomperada.com

If you like this video please click the LIKE button, SHARE, and SUBSCRIBE to my channel.

Your support on my channel is highly appreciated.

Thank you very much.

Program Listing

/* selection_sort.cpp
       
    Machine Problem in C++
    
	Write a program to ask the user to give a series of
	numbers and then the program will sort the given 
	numbers using selection sort algorithms.
	    
    Jake R. Pomperada, MAED-IT, MIT
    www.jakerpomperada.com
    www.jakerpomperada.blogspot.com
    [email protected]
    Bacolod City, Negros Occidental, Philippines

*/ 

#include <iostream>

void selection_sort();

int i=0,a[100], num=0;

int main()
{
    
    std::cout <<"\n\n";
    std::cout <<"\tSelection Sort in C++";
    std::cout <<"\n\n";
    std::cout <<"\tHow many items in the array? : ";
    std::cin >> num;
	std::cout <<"\n\n";
    
      for(i=0; i<num; i++) {
     	   std::cout <<"\tGive value in item no." << i+1 << " : ";
     	   std::cin >> a[i];
        }
    std::cout <<"\n\tBefore sorting:\n";
    std::cout <<"\n";
	std::cout <<"\t";
    for(i=0; i<num; i++)
        std::cout << " " << a[i] << " ";
    selection_sort();
    std::cout <<"\n";
    std::cout <<"\n\tAfter sorting:\n";
    std::cout <<"\n";
	std::cout <<"\t";
    for(i=0; i<num; i++)
        std::cout << " " << a[i] << " ";
    std::cout <<"\n\n";
    std::cout <<"\tEnd of Program";
	}

void selection_sort()
{
    int i, j, min, temp;
    for (i=0; i<num; i++)
    {
        min = i;
        for (j=i+1; j<num; j++)
        {
            if (a[j] < a[min])
                min = j;
        }
        temp = a[i];
        a[i] = a[min];
        a[min] = temp;
    }
}
Categories
C

Selection Sort in C

  Machine Problem in C

Write a program to ask the user to give a series of numbers and then the program will sort the given numbers using selection sort algorithms.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following [email protected], [email protected], and [email protected]

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod City I also accepting computer repair, networking, and Arduino Project development at a very affordable price. My website is www.jakerpomperada.blogspot.com and www.jakerpomperada.com

If you like this video please click the LIKE button, SHARE, and SUBSCRIBE to my channel.

Your support on my channel is highly appreciated.

Thank you very much.

Program Listing

/* selection_sort.c
       
    Machine Problem in C
    
	Write a program to ask the user to give a series of
	numbers and then the program will sort the given 
	numbers using selection sort algorithms.
	    
    Jake R. Pomperada, MAED-IT, MIT
    www.jakerpomperada.com
    www.jakerpomperada.blogspot.com
    [email protected]
    Bacolod City, Negros Occidental, Philippines

*/ 

#include <stdio.h>

void selection_sort();

int i=0,a[100], num=0;

int main()
{
    
    printf("\n\n");
    printf("\tSelection Sort in C");
    printf("\n\n");
    printf("\tHow many items in the array? : ");
    scanf("%d", &num);
    printf("\n\n");
      for(i=0; i<num; i++) {
     	   printf("\tGive value in item no. %d : ",i+1);
		   scanf("%d", &a[i]);
        }
    printf("\n\tBefore sorting:\n");
    printf("\n");
	printf("\t");
    for(i=0; i<num; i++)
        printf(" %d ", a[i]);
    selection_sort();
    printf("\n");
    printf("\n\tAfter sorting:\n");
    printf("\n");
    printf("\t");  
	for(i=0; i<num; i++)
        printf(" %d ", a[i]);
    getch();
}

void selection_sort()
{
    int i, j, min, temp;
    for (i=0; i<num; i++)
    {
        min = i;
        for (j=i+1; j<num; j++)
        {
            if (a[j] < a[min])
                min = j;
        }
        temp = a[i];
        a[i] = a[min];
        a[min] = temp;
    }
}