บทที่ 6

ตอบกระทู้

รูปแสดงอารมณ์
:icon_plusone: :like: :plusone: :gfb: :-D :) :( :-o 8O :? 8) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :!: :?: :idea: :arrow: :| :mrgreen: :angry: :baa: :biggrin:
รูปแสดงอารมณ์อื่นๆ

BBCode เปิด
[img] เปิด
[url] เปิด
[Smile icon] เปิด

กระทู้แนะนำ
   

มุมมองที่ขยายได้ กระทู้แนะนำ: บทที่ 6

โดย icphysics » 27/09/2004 8:01 pm

/*บทที่ 6 ข้อ 7 */
/*เขียนใหม่เป็นดังนี้*/
while((chr=getchar())!='\n')
{
if(chr!=chr)
contunue;
putchar(chr);
}

โดย icphysics » 27/09/2004 7:57 pm

/* ข้อ บทที่ 6 ข้อ 6จ */
#include<stdio.h>
void main()
{
int k=0,total;
for(total=0,k=1;k<=10;total+=k++)
printf("\tk=%3d \n",k);
printf("\total =%3d \n",total);
printf(" befor for loop k==%3d\n",k);
}
/* total =55
k=11
*/

โดย icphysics » 27/09/2004 7:55 pm

/*ข้อ บทที่ 6 ข้อ 6ง */
#include<stdio.h>
void main()
{
int k=0;
do {
printf("\t befor k++ k=%3d \n",k);
++k;
printf("\tk=%3d \n",k);
}
while (k++<20);

printf(" befor for loop k===%3d\n",k);
}
/*total= 55
k=11
*อ

โดย icphysics » 27/09/2004 7:52 pm

/* ข้อ บทที่ 6 ข้อ 6ค */
#include<stdio.h>
void main()
{
int k=0,w;
for(k=0,w=k++;k<20;++k)
printf("\tk=%3d \n",k);
printf(" befor for loop k===%3d\n",k);
}
/* ค่า k=20*/

โดย icphysics » 27/09/2004 7:51 pm

/* ข้อ บทที่ 6 ข้อ 6ข */
#include<stdio.h>
void main()
{
int k=0;
while(++k <=20)
printf("\tk=%3d \n",k);
printf(" befor while loop k===%3d\n",k);
}
/* ค่า k=20*/

บทที่ 6

โดย icphysics » 27/09/2004 7:49 pm

/*บทที่ 6 ข้อ 6.ก*/
#include<stdio.h>
void main()
{
int k=0;
while(k++ <=20)
printf("\tk=%3d \n",k);
printf(" befor while loop k===%3d\n",k);
}

/* ตอบ k=21 */

ข้างบน