รบกวนเชคโปรแกรมกับวาดFlowchart ให้หน่อยครับ..Source Code จากพี่ๆในบอร์ดนี้แหละครับ
โปรแกรม หา ค.ร.น. ครับ
Run แล้ว กด Enter อีกครั้งเพื่อจบโปรแกรมและมันค้างอ่ะครับ.. รบกวนช่วยเชคและแก้ไขให้ผมหน่อยครับ.. ผม ใช้ Turbo C++ 4.5 ครับผม..
Source Code นะครับ..
#include<stdio.h> #include<conio.h> void main (void) { int a,b,max,min,r,max_1,clm; clrscr(); printf("Enter number A:"); scanf("%d",&a); printf("Enter number B:"); scanf("%d",&b); if (a>b) { max=a; min=b; } else { max=b; min=a; } max_1=max; r=max%min; while (r!=0) { max=max+max_1; r=max%min; } clm=max; printf("Least Common Multiple = %d",clm); getch(); }
โปรแกรมที่ 2 หา Matrix ครับผม Run แล้ว กด Enter อีกครั้งเพื่อจบโปรแกรมและมันค้างเหมือนกับโปรแกรมแรกเลยครับ..รบกวนเชคและแก้ไขให้หน่อยครับ..
Source Code ครับ..
#include<stdio.h> #include<conio.h> void main() { clrscr(); int matrix[3][3],i,j; for(i=1;i<4;i++) { for(j=1;j<4;j++) { printf("\n\t\tEnter Number[%d][%d]\t:\t",i,j); scanf("%d",&matrix[i][j]); } } printf("\n\t*****Matrix*****\n"); for(i=1;i<4;i++) { for(j=1;j<4;j++) { printf("\t%d",matrix[i][j]); } printf("\n"); } getch(); }
ขอบคุณครับ..
|