# data[].attributes.body
#include <stdio.h>

#include <conio.h>

int main()

{

float rate = 0.0;

float consumption = 0.0;

float cost = 0.0;

printf("Electricity rate per kilowatt hour :");

scanf("%f", &rate);

printf("Amount of electricity used (kilowatt hour unit) : ");

scanf("%f",&consumption);

cost = rate * consumption;

printf("Electricity cost: %.2f baht\n", cost);

return 0;

}

# data[].attributes.body
#include <stdio.h>
#include <conio.h>
int main()    {
int Watt;
float Hours,Power,Unit,Payment;
printf("Program of Calculation your Electric\n");
printf("----------------------------------------------------------\n");
printf("Enter Watt:  ");
scanf ("%d",&Watt);
printf("Enter Hours:  ");
scanf("%f",&Hours);
Power = Watt*Hours;
Unit = Power/1000;
Payment = Unit*3.99;
printf("Your payment of electric is: %.2f\n",Payment);
getch();
}

# data[].attributes.body
#include<stdio.h>

#include<conio.h>

int main()

{

int points;

printf("How many points can you score?: ");

scanf("%d",&points);

if(points>=50){

printf("You have a score of more than 50\n");

printf("pass exam...Congretulations\n");

}

else

{

printf("Fail...Attempt again\n");

}

printf("Your score = %d\n",points);

printf("Bye bye...see you again next semester \n");

getch();

return(0);

}

# data[].attributes.body
#include<stdio.h>
#include<conio.h>
int main()
{
float score;
char grade;
printf("Input Your Score : ");
scanf("%f",&score);
if (score>=80)
grade= 'A';
else if (score>=70)
grade='B';
else if (score>=60)
grade='C';
else if (score>=50)
grade='D';
else
grade='F';
printf("Your's Score = %.2f \n",score);
printf("Grade = %c ",grade);
getch();

# data[].attributes.body
#include<stdio.h>
#include<conio.h>
int main()
{
int sum = 1;
int fac, count = 1;
printf("Please enter number of factorial : ");
scanf("%d", &fac);
while (count<=fac)
{
sum = sum*count;
count = count + 1;
}
printf("Result of %d!  is  %d",fac,sum);
getch();
}

# data[].attributes.body
#include<stdio.h>

#include<conio.h>

int main()

{

int month;

printf("Enter Your Month : (1-12) ");

scanf("%d",&month);

switch (month)

{

case 1 :

printf("January \n");

printf("Happy New Year \n");

printf("Children’s Day \n");

break;

case 2 :

printf("February \n");

printf("veterans day \n");

printf("world cancer day \n");

break;

case 3 :

printf("March \n");

printf("International Day to End Discrimination \n");

printf("World Wildlife and Flora Day \n");

break;

case 4 :

printf("April \n");

printf("world health day \n");

printf("air force day \n");

break;

case 5 :

printf("May \n");

printf("National Labor Day \n");

printf("world tuna day \n");

break;

case 6 :

printf("June \n");

printf("Ananda Mahidol Day \n");

printf("International Day Against Child Labor \n");

break;

case 7 :

printf("July \n");

printf("National Boy Scout Foundation Day \n");

printf("International Plastic Bag Free Day \n");

break;

case 8 :

printf("August \n");

printf("Thai Women's Day National \n");

printf("Communication Day / Thai Veterinarian Day \n");

break;

case 9 :

printf("September \n");

printf("Doraemon's birthday \n");

printf("international charity day \n");

break;

case 10 :

printf("October \n");

printf("world smile day \n");

printf("international breast cancer day \n");

break;

case 11 :

printf("November \n");

printf("World city planning day\n");

printf("National Day of Persons with Disabilities \n");

break;

case 12 :

printf("December \n");

printf("International Day of the Abolition of Slavery \n");

printf("International Day of Persons with Disabilities \n");

break;

default :

printf("Error \n");

printf("Please enter Numer (1-12) only, Thank you \n");

}

getch();

}

# data[].attributes.body
#include<stdio.h>

#include<conio.h>

int main()

{

int i = 1;

float weight,sum = 0;

while (i<=10)

{

printf("Enter Weight :");

scanf("%f",&weight);

sum += weight;

i++;

}

printf("Sum of Weights = %.2f\n",sum);

printf("Average of Weights = %.2f\n",sum/10);

getch();

}

# data[].attributes.body
#include<stdio.h>

#include<conio.h>

int main()

{

int i = 1;

float weight,sum = 0;

do

{

printf("Enter Weight :");

scanf("%f",&weight);

sum += weight;

i++;

}

while (i<=10);

printf("Sum of Weights = %.2f\n",sum);

printf("Average of Weights = %.2f\n",sum/10);

getch();

}

# data[].attributes.body
#include <stdio.h>

#include <conio.h>

int main()

{

for (int i = 1; i <= 10; i++) {

printf("%d\n", i);

}

return 0;

getch();

}

# data[].attributes.body
#include <stdio.h>

#include <conio.h>

int main()

{

for (int i = 1, j = 10; i < j; i++, j--) {

printf("i = %d, j= %d\n", i, j);

}

return 0;

getch();

}