"ชีวิตคนเราไม่แน่ไม่นอน แต่ะคนมีจุดหมายปลายทางที่ต่างกัน"

Loop (for) show amazing (*)

August 7, 2012

เมื่อวานผมนั่งรถเรื่อยๆ จากบ้านที่อยู่พัทลุง ไปยังมหาลัยที่อยู่ภูเก็ต แล้วก็ได้หยิบ คอมพิวเตอร์ขึ้นมา แล้วเปิด Dev-C แล้วลองนึกอะไรเล่นๆ ดู แล้วทดสอบเขียน Code ขึ้นมาเพื่อสร้างรูปสามเหลี่ยมโดยใช้ “*” ซึ่งผลที่ได้ก็เป็นดังรูปครับ :: Code ::     #include <stdio.h> #include <conio.h>   main() { int a,b,c; for(a=1;a<=20;a++) { for(b=1;b<=a;b++) { printf("* "); } printf(" \n"); }   for(a=1;a<=20;a++) { for(b=19;b>=a;b–) { printf("* "); } printf(" \n"); }   getch(); } #include <stdio.h> #include <conio.h> […]

เฉลยข้อสอบ Lab Computer Programming

July 24, 2012

1. /* Computer Programing Exam 1 By Weerayut Hongsa (Kusumoto) http://kusumoto.co */   #include <stdio.h> main() { int a,b,c; //announce variables do{ //start loop statement printf("Enter Number >> "); //input number to process scanf("%d",&a); //submit to variable for (b=a;b>=1;b–) { //loop to process sum data printf("%d +%d = %d \n",b,b,b+b); //show loop sum data } […]

Multiplication table Process (Use While)

July 17, 2012

#include <stdio.h> main() { int x,y=1; printf("Enter number : "); scanf("%d",&x); while(y<=12) { printf("%d * %d = %d \n",x,y,(x*y)); y++; } }#include <stdio.h> main() { int x,y=1; printf("Enter number : "); scanf("%d",&x); while(y<=12) { printf("%d * %d = %d \n",x,y,(x*y)); y++; } }

Multiplication table Process

July 10, 2012

/* Multiplication table Process Build By C Language Dev By :: Weerayut Hongsa (Kusumoto) http://kusumoto.co */ #include <stdio.h>   main() { int x; //announce variable int y; //announce variable int z; //announce variable printf("Enter Number : "); //show msg input scanf("%d",&z); //get input data for(x=1; x<=12; x++) //loop Condition if (y=x*z) printf("%d * %d = […]

Basic Commission Process

July 9, 2012

โจทย์ ร้านค้าแห่งหนึ่งกำหนดให้พนักงานขายจะได้รับเงินเดือนเป็นรายเดือน และถ้าขายสินค้าได้จะมีเงินค่าคอมมิชชั่น (Commission) นอกเหนือจากเงินเดือน ให้ตามหลักเกณฑ์ ดังนี้ ยอดขาย Commission ตั้งแต่ 50,000 แต่ไม่ถึง 100,000 5% ตั้งแต่ 100,000 แต่ไม่ถึง 200,000 10% ตั้งแต่ 200,000 ขึ้นไป 15% จงเขียนโปรแกรมเพื่อรับเงินเดือน ยอดขายรายเดือน แล้วคำนวณหาค่า Commission แล้วพิมพ์ยอดรวมที่พนักงานขายจะได้รับ /* Basic Commission Process Build By C Language Dev By :: Weerayut Hongsa (Kusumoto) http://kusumoto.co */ #include <stdio.h> #include <conio.h> main() { int a; //announce variable float […]

Basic Grade Process

July 3, 2012

หลังจากได้เรียนวิชา C และได้เรียนในเรื่องของ Function if ผมก็ลองเขียนโปรแกรมเล่นๆ สั้นๆ ง่ายๆ พร้อมกับทดสอบ Function else ด้วย ด้วยโปรแกรมวิเคราะห์เกรด แบบง่ายๆ ดังนี้ /* Basic Grade Process Build By C Language Dev By :: Weerayut Hongsa (Kusumoto) http://kusumoto.co */   #include <stdio.h> #include <conio.h> main(){ int a; //announce variable a = 0; //set variable to 0 because fixed bug printf ("Please Insert Score […]

Basic Calculator

July 2, 2012

#include <stdio.h> main() { int a,b; //Notice Array printf ("Please insert number 2 number ::"); //Show insert number scanf ("%d %d",&a,&b); //Get Data printf ("Answer :: %d \n",a+b); //Show Process Data //End }#include <stdio.h> main() { int a,b; //Notice Array printf ("Please insert number 2 number ::"); //Show insert number scanf ("%d %d",&a,&b); //Get Data […]

[C] Lab C Day2

June 26, 2012

#include <stdio.h> main() { char a[20]; char h[20]; int b,c,d,e,f; char g; printf("Enter Name-surname :: "); scanf("%s %s",&a,&h); printf("Enter Age :: "); scanf("%d", &b); printf("Enter Height :: "); scanf("%d", &c); printf("Enter Weight :: "); scanf("%d", &d); printf("Sex :: "); scanf("%s", &g); printf("Enter Number 1 :: "); scanf("%d", &e); printf("Enter Number 2 :: "); scanf("%d", &f); […]