Thursday, January 17, 2019

Reverse a Number in C

A sample program that will ask the user an integer and then the program will reverse the arrangement of the number.

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 in 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 jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

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 I also accepting computer repair, networking and Arduino Project development at a very affordable price.

My personal website is http://www.jakerpomperada.com


Program Listing

#include <stdio.h>
#include <conio.h>

void main()
{
   int NUM, R = 0;
   clrscr();

   printf("Enter a number to reverse\n");
   scanf("%d", &NUM);

   while (NUM != 0)
   {
      R = R * 10;
      R = R + NUM%10;
      NUM= NUM/10;
   }

   printf("After reversing the Number is = %d\n", R);

   getch();
}

Greatest Common Divisor of two integers in C

A simple program Greatest Common Divisor of two integers in C 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 in 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 jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

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 I also accepting computer repair, networking and Arduino Project development at a very affordable price.

My personal website is http://www.jakerpomperada.com


Program Listing

#include <stdio.h>
#include <conio.h>

void main() {
  int x, y,a,b,t,G;
  clrscr();

  printf("Enter two integers\n");
  scanf("%d %d", &x, &y);

  a = x;
  b = y;

  while (b != 0) {
    t = b;
    b = a % b;
    a = t;
  }
  G = a;
  printf("GCD for %d and %d is ", x, y);
  printf("%d",G);
  getch();
}

Alphabet Checking For Vowels in C

Here is a simple program to ask the user to give a character and then the program will check if the given alphabet is a vowel or not using C 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 in 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 jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

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 I also accepting computer repair, networking and Arduino Project development at a very affordable price.

My personal website is http://www.jakerpomperada.com


Program Listing


#include <stdio.h>
#include <conio.h>

void main()
{
  char ch;
  clrscr();
  printf("Enter a character ");
  ch=getch();

if(ch==65)
{
printf("%c is Vowel",ch);
}
else
if(ch==69)
{
printf("%c is Vowel",ch);
}
else
if(ch==73)
{
printf("%c is Vowel",ch);
}
else
if(ch==79)
{
printf("%c is Vowel",ch);
}
else
if(ch==85)
{
printf("%c is Vowel",ch);
}
else

printf("The Character %c is not vowel",ch);

getch();

}

Compare Two Strings in C

Here is a simple program to compare two string given by the user in C 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 in 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 jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

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 I also accepting computer repair, networking and Arduino Project development at a very affordable price.

My personal website is http://www.jakerpomperada.com


Program Listing

include<stdio.h>
#include<conio.h>

void strcmpr(char[],char[]);

void main()

{

    char S1[20],S2[20];
    int COMP;
    clrscr();

    printf("ENTER STRING 1 ");
    scanf("%s",S1);

    printf("ENTER STRING 2 ");
    scanf("%s",S2);

     strcmpr(S1,S2);

getch();

}

void strcmpr(char S1[],char S2[])

{
    int i=0,flag=0;
   
     while(S1[i]!='\0' && S2[i]!='\0')   
  {
         if(S1[i]!=S2[i]){
             flag=1;
             break;
  }
         i++;
    }

    if (flag==0 && S1[i]=='\0' && S2[i]=='\0')
       
  printf("BOTH STRINGS ARE EQUAL");

    else
    printf("BOTH STRINGS ARE NOT EQUAL ");

}

Friday, January 11, 2019

Update a Record Using Python and MySQL

A simple program that will show you how to update a record using Python and MySQL. I have a great time learning Python it is easy to so many  information that I can learn and get over the Internet.

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 in 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 jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

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 I also accepting computer repair, networking and Arduino Project development at a very affordable price.

My personal website is http://www.jakerpomperada.com


Program Listing


import pymysql

connection = pymysql.connect(
    host='localhost',
    user='root',
    password='',
    db='my_python',
)

print("")
print("UPDATE RECORD")
print("")
id1 = input("Enter users ID Number : ")
name1 = input("Enter users name : ")
age1 = input("Enter users age : ")
address1 = input("Enter users address :  ")
print("")
try:
    with connection.cursor() as cursor:
        sql = "UPDATE users SET name=%s, age=%s,address=%s WHERE id = %s"
        try:
            cursor.execute(sql,(name1.upper(),age1,address1.upper(),id1))
            print("Record Successfully updated in the database")
        except:
            print("Oops! Something wrong")

    connection.commit()
finally:
    connection.close()

Delete a Record Using Python and MySQL

Here is a code that will show and teach you how to delete a single record in Python and MySQL.

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 in 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 jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

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 I also accepting computer repair, networking and Arduino Project development at a very affordable price.

My personal website is http://www.jakerpomperada.com


Program Listing


import pymysql

connection = pymysql.connect(
    host='localhost',
    user='root',
    password='',
    db='my_python',
)

print("")
print("DELETE RECORD")
print("")

id = input("Enter users ID Number :  ")
print("")
try:
    with connection.cursor() as cursor:
        sql = "DELETE FROM users WHERE id = %s"
        try:
            cursor.execute(sql,(id))
            print("Record Successfully deleted in the database")
        except:
            print("Record not found")

    connection.commit()
finally:
    connection.close()

View Record Using Python and MySQL

A code that will teach you how to view records using Python and MySQL.  I am still a beginner in Python programming which I find it interesting to learn.

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 in 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 jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

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 I also accepting computer repair, networking and Arduino Project development at a very affordable price.

My personal website is http://www.jakerpomperada.com


Program Listing

import pymysql

connection = pymysql.connect(
    host='localhost',
    user='root',
    password='',
    db='my_python',
)

try:
    with connection.cursor() as cursor:
        sql = "SELECT id,name,age,address FROM USERS ORDER BY ID ASC"
        try:
            cursor.execute(sql)
            result = cursor.fetchall()

            print("ID\t\t\tName\t\t\t\t Age\t\t\t\t\tAddress")
            print("---------------------------------------------------------------------------")
            for row in result:
                print(str(row[0]) + "\t\t\t" +row[1] + "\t\t\t" + row[2] + "\t\t\t" + row[3])

        except:
            print("Oops! Something wrong")

    connection.commit()
finally:
    connection.close()


Insert Record Using Python and MySQL

Here is a simple code that I wrote how to insert a record using Python and MySQL. The code is very simple and easy to understand.

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 in 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 jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

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 I also accepting computer repair, networking and Arduino Project development at a very affordable price.

My personal website is http://www.jakerpomperada.com



Program Listing

insert.py


import pymysql

connection = pymysql.connect(
    host='localhost',
    user='root',
    password='',
    db='my_python',
)

print("")
print("ADD RECORD")
print("")
name1 = input("Enter users name : ")
age1 = input("Enter users age : ")
address1 = input("Enter users address :  ")
print("")
try:
    with connection.cursor() as cursor:
        sql = "INSERT INTO users(name,age,address) VALUES (%s,%s,%s)"
        try:
            cursor.execute(sql, (name1.upper(),age1,address1.upper()))
            print("Record Successfully added in the database")
        except:
            print("Oops! Something wrong")

    connection.commit()
finally:
    connection.close()


Tuesday, January 8, 2019

Three Light Emitting Diode Running Lights in Arduino


In this article I would like to share with you a sample program that I wrote using C for Arduino to perform Three Light Emitting Diode Running Lights. The code is very simple and short I am still a beginner in Arduino Programming. I hope you will find my work useful. I used Microsoft Windows XP Service Pack 2 as my operating system, Arduino UNO and Arduino IDE in the development of this application.

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 in 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 jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

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 I also accepting computer repair, networking and Arduino Project development at a very affordable price.

My personal website is http://www.jakerpomperada.com







Sample Program Output


Program Listing

/* Three LED Blinkers
 *  Written By Mr. Jake Rodriguez Pomperada,MAED-IT
 *  Date : January 8, 2018      8:16 PM   Tuesday
 *  Bacolod City, Negros Occidental
 *  jakerpomperada@yahoo.com and jakerpomperada@gmail.com
 */

/* A simple program to sequentially turn on and turn off 3 LEDs */ 

int LED1 = 13;
int LED2 = 12;
int LED3 = 11;

void setup() {
   pinMode(LED1, OUTPUT);
   pinMode(LED2, OUTPUT);
   pinMode(LED3, OUTPUT);
}

void loop() {
  digitalWrite(LED1, HIGH);    // turn on LED1 
  delay(300);                  // wait for 300ms
  digitalWrite(LED2, HIGH);    // turn on LED2
  delay(300);                  // wait for 300ms       
  digitalWrite(LED3, HIGH);    // turn on LED3 
  delay(300);                  // wait for 300ms
  digitalWrite(LED1, LOW);     // turn off LED1
  delay(200);                  // wait for 200ms
  digitalWrite(LED2, LOW);     // turn off LED2
  delay(200);                  // wait for 200ms
  digitalWrite(LED3, LOW);     // turn off LED3
  delay(200);                  // wait for 200ms before running program all over again
}

Login Using a Text File in C

While I'm writing my book on C programming I came across with the idea to include in my book topic on File Handling in C.  The idea is to write a program using C as my programming language to store a username and password in a text file and create a login program that will ask the user to give the username and password. The program will search for the username and password that is already stored in our text file. In this example the name of the text file is users.txt. I

If the username and password are correct and can be located in the text file the program will allow the user to access the system. But if username or password is incorrect the program will not allow the user to access the system. I hope you will find my work useful.  Thank you.

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 in 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 jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

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 I also accepting computer repair, networking and Arduino Project development at a very affordable price.

My personal website is http://www.jakerpomperada.com





Sample Program Output


Program Listing

/* login.c 
 Author    : Jake Rodriguez Pomperada,MAED-IT 
 Website   : http://www.jakerpomperada.com
 Emails    : jakerpomperada@gmail.com and jakerpomperada@aol.com
 Location  : Bacolod City, Negros Occidental
 Tool      : Dev C++ Version 5.11
 Date      : January 7, 2019   3:46 PM Monday
*/

#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
#include <string.h>

void get_ID_and_PASS(char fileName[30],char *id,char *pass)
{
    FILE *F = fopen(fileName,"r");

    if(F)
    {
        int count = 0;
        while(!feof(F))
        {
            char rawLine[50];
            fscanf(F,"%s",rawLine);
            if(!count++)
                strcpy(id,rawLine);
            else
                strcpy(pass,rawLine);

        }
    }else printf("Cannot open this file");
    fclose(F);
}

int main()
{
    char fileName[30] = "users.txt";
    char userID[50],userPassW[50];
    char strID[50]="\0",strPASSW[50]="\0";
    char IDpref[50] = "user_id:\0",PASSWpref[50] = "password:\0";
    get_ID_and_PASS(fileName,userID,userPassW);
    char c;
    int pos = 0;
        printf("\n\n");
        printf("\tLOGIN SECURITY SYSTEM IN C USING TEXT FILES");
        printf("\n\n");
        printf("\tEnter User Name      : ");
        scanf("%s",&strID);
        printf("\n");
        printf("\tEnter Your Password  : ");
        do {
        c = getch();

        if( isprint(c) ) 
        {
            strPASSW[ pos++ ] = c;
            printf("%c", '*');
        }
        else if( c == 9 && pos )
        {
            strPASSW[pos--] = '\0';
            printf("%s", "\b \b");
        }
    } while( c != 13 );
        strcpy(strID,strcat(IDpref,strID));
        strcpy(strPASSW,strcat(PASSWpref,strPASSW));

        if (!strcmp(strID,userID)&&!strcmp(strPASSW,userPassW))
        {
            printf("\n\n");
            printf("\tCorrect Username And Password\n");
            printf("\n\n\tWelcome to the System\n\n"); 
        }
        else
        {
           printf("\n\n");
           printf("\tInvalid Username And Password. Try Again\n\n");
         }
     printf("\n\n");
     printf("\tEND OF PROGRAM");
     printf("\n\n");
     system("pause");
}


users.txt

user_id:admin
password:Jake123!@#