C
C
#include<stdio.h>;
int main()
//{
// int a,n,i,ans;
// printf("Enter a=");
// scanf("%d",&a);
// n=2;
// while(n<=a)
// {
// ans=1;
// for(i=2;i<=n/2;i++)
// {if(n%i==0)
// ans=0;
// break;}
// if(ans==1)
// printf("%d",n);
// n++;
// return 0;
//}}
//{
//int n,sum=0;
//printf("input n:");
//scanf("%d",&n);
//while(n!=0) {
// sum+=n%10;
// n=n/10;
//}
//}
//enter an int number a (0<a<10), print first 20 numbers of array (1,1+a,1+2a...) and summmary of them.
int a,i,sum,;
printf("enter a=");
scanf("%d",&a);
while(0<a<10)
for(int i=0;i<20;i++)
printf("%d",1+a*i);
sum+=1+i*a;}
return 0;
#include<stdio.h>;
int main()
//{
// float a,b,x;
// printf("Enter a=");
// scanf("%f",&a);
// printf("Enter b=");
// scanf("%f",&b);
// x=-b/a;
// if(a!=0)
// printf("x=%f",x);
//{
//float x,y;
//printf("enter x=");
//scanf("%f",&x);
//if(x<=0)
//printf("y=%f",x+5);
//else printf("y=%f",2*x-3);
//
//display weekend
//{
//int n;
//scanf("%d",&n);
//else
//{switch(n)
//{
//case 1:
//printf("\n Sunday");
//break;
//case 2:
//printf("\n Monday");
//break;
//case 3:
//printf("\n Tuesday");
//break;
//case 4:
//printf("\n Wednesday");
//break;
//case 5:
//printf("\n Thursday");
//break;
//case 6:
//printf("\n Friday");
//break;
//case 7:
//printf("\n Sartuday");
//break;
//}}
//}
int n;
printf("Welcome to Cloudy");
scanf("%d",&n);
{switch(n)
case 1:
break;
case 2:
break;
case 3:
break;
default:
printf("Invalid drink");
}}
} //#include <stdio.h>
//int main(void) {
// int x=200;
//}
#include <stdio.h>
//int main(void) {
// char x='c';
// char y='d';
//}
//#include <stdio.h>
//int main(void) {
// int i=200;
// float x=3.2167;
// char y='o';
// char z='z';
// int a=23;
// int b=5;
//
// printf("imcloud9");
// printf("\nhehehehehehehe");
// printf("\n%10.4d",i);
//}
#include<stdio.h>
int main(void)
int a,b,c;
int sum;
printf("\nenter a:");
scanf("%d",&a);
printf("\nenter b:");
scanf("%d",&b);
printf("\nenter c:");
scanf("%d",&c);
sum=a+b+c;
printf("\na+b+c=%d", sum);
//Program with for the answer of a girl: if the boy is interesting or graceful then the answer is Yes, otherwise the
answer is No.
#include<stdio.h>
int main(void)
int x,y;
scanf("\n%d",&x);
if(x==1)
printf("\n yes");
else
printf("\n no");
scanf("\n%d",&y);
if(y==1)
printf("\n yes");
else
printf("\n no");
return 0;
int a,b,c;
printf("enter a=");
scanf("%d",&a);
printf("enter b=");
scanf("%d",&b);
printf("enter c=");
scanf("%d",&c);
} else {
return 0;
//#include<stdio.h>;
//#define max
//#define factorial
//int main()
//{
// int a;
// do {
// scanf("%d", &a);
// if (a <= 0) {
// }
//}
#include<stdio.h>;
#include <math.h>
int main(void)
return 0;
//#include<stdio.h>;
//int main(void) {
//{
// float C, F;
// scanf("%f",&F);
// C=(F-32)/1.8;
// printf("The temperature in C:%.2f",C);
//}
//#include<stdio.h>;
//#include <math.h>
//int main(void)
//{
//float x,y,z;
//printf("*******************\n");
//printf("*******************\n");
//printf("enter x:");
//scanf("%f",&x);
//printf("enter y:");
//scanf("%f",&y);
//z=2*pow(x,4)+4*pow(y,2)+9;
//printf("result z:%.2f",z);
//}
//#include<stdio.h>;
//int main(void)
// {
//
// int a,b;
// printf("a=");
// scanf("%d",&a);
// printf("b=");
// scanf("%d",&b);
// if (a>b)
// if (a==b)
// printf("a equal b");
// return 0;
//}
//even or odd?
//#include<stdio.h>;
//int main(void)
//{
//int a;
//printf("enter a=");
//scanf("%d",&a);
//if(a%2==0)
//printf("\n %d is even",a);
//else
//printf("\n %d is odd",a);
//return 0;
//}
//Ex3:Write a program to enter 3 integer numbers from keyboard, choose a number from 1 to 3 to pick one number
to calculate the factorial of it.
//#include<stdio.h>;
//#define max
//int enternumber()
//scanf("%d",&num);
//for(;;)
//{ if(num<=0)
//scanf("%d",&num);
//}else break;
//}
//return num;
//}
//long Factorial(int n)
//{ int i;
//long result=1;
//for(i=1;i<=n;i++)
//{result=result*i;
//}
//return result;
//}
//
//int main(void)
//long fact;
//int choice;
////nhap 3 so
//a=enternumber();
//b=enternumber();
//c=enternumber();
//
//scanf("%d",&choice);
//while(choice<1||choice>3)
//scanf("%d",&choice);
//}
//switch(choice)
// }
//}
//Ex4:Write a program to enter the sale amount of Quarter 1 -> 4 and show the VAT taxes amount (10%) for each
Quarter and Total tax.
//Ex5: enter costs of goods from vendor A,B,C and total sales of each of them. Show the max value for cost, sale
amount and margin (margin=(sale price-cost price)/cost price)
#include<stdio.h>;
#define max
//
//int enteramount()
//printf("enter a number>0:");
//for(;;)
//scanf("%f",&amount);
//{ if(amount<=0)
//{printf("enter a number>0:");
//scanf("%f",&amount);
//}else break;
//}
//return amount;
//
//
//int main()
//{
// float a,b,c, Sa, Sb, Sc;
// int maximum=max(a,max(b,c));
//}
#include<stdio.h>;
float enternumber()
{ float num;
printf("enter a number>0:");
for(;;)
scanf("%f",&num);
{ if(num<=0)
{printf("enter a number>0:");
scanf("%f",&num);
}else break;
return num;
{return (a*a+b+c)/4;
}
{if(a>=b&&a>=c) return a;
if(b>=a&&b>=c) return b;
if(c>=b&&c>=a) return c;
int main()
int a,b,c;
//Menu 5 types of drink, write program to enter a drink selection and print out the drink with its price. Ask the top up
milk for coffee with add 5k into the price.
#include<stdio.h>;
int main()
int n,m,l1,l2;
printf("Welcome to Cloudy");
scanf("%d",&n);
{switch(n)
case 1:
break;
case 2:
break;
case 3:
break;
case 4:
printf("Smoothie - 45k");
break;
case 5:
break;
default:
printf("Invalid drink");
}}
printf("\n If you want to add more milk for coffee with, add 5k into the price!");
scanf("%d",&m);
if (m == 1) {
if (n == 1) {
else if (n == 2){
else if (n == 3){
else if (n == 4){
if (m == 0) {
if (n == 1) {
if (n == 2){
if (n == 3){
if (n == 4){
else{
return 0;
//Write a program to solve quadratic equation: ax2+ bx + c = 0 with a,b,c from the keyboard. (use library: <math.h>,
statement sqrt() for square root function).
#include<stdio.h>;
#include<math.h>;
int main()
float a,b,c,x,x1,x2,d;
printf("\nEnter a=");
scanf("%f",&a);
printf("Enter b=");
scanf("%f",&b);
printf("Enter c=");
scanf("%f",&c);
d=b*b-(4*a*c);
if (d<0) {
printf("\n No solution");}
else if(d=0) {
printf("\n x1=x2=%.2f",-b/(2*a));}
else {
printf("\n x1=(-b+sqrt(d))/(2*a)=%.2f",(-b+sqrt(d))/(2*a));
printf("\n x1=(-b-sqrt(d))/(2*a)=%.2f",(-b-sqrt(d))/(2*a));}
return 0;
//Enter scores (in range 10) of 3 subjects & its credit, calculate the average score in range 4 and classify it with
following conditions: A (3.4-4.0), B(2.8 - <3.4),C (2.2- <2.8), D (1.6- <2.2), F (<1.6).
#include<stdio.h>;
int main()
float a,b,c,d;
int a1,b1,c1;
scanf("%f",&a);
scanf("%d",&a1);
scanf("%f",&b);
scanf("%d",&b1);
scanf("%f",&c);
d=(float)(((a*a1+b*b1+c*c1)/(a1+b1+c1))*0.4);
if(d>3.4&&d<4.0) {
else if(d>2.8&&d<3.4) {
else if(d>2.2&&d<2.8) {
else if(d>1.6&&d<2.2) {
return 0;
//Program with for the answer of a girl: if the boy is interesting or graceful then the answer is Yes, otherwise the
answer is No.
#include<stdio.h>
int main(void)
//{
// int x=0,y=1;
// scanf("\n%d",&x);
// if(x==1)
// printf("\n yes");
// else
// printf("\n no");
// scanf("\n%d",&y);
// if(y==1)
// printf("\n yes");
// else