MapleStory Finger Point

πŸ”΅ C,C++,C#/πŸ“šCore C_Programming

[C/Core C Programming] Chpater3

HYEJU01 2023. 3. 27. 19:18
//1
#include <stdio.h>


int main() {

	int n;
	printf("ν•œλ³€μ˜ 길이?");
	scanf_s("%d", &n);
	printf("μ •μ‚¬κ°ν˜•μ˜ 넓이: %d\n",n*n);
	printf("μ •μ‚¬κ°ν˜•μ˜ λ‘˜λ ˆ: %d\n",n*4);
	return 0;
    
//2
#include <stdio.h>
int main() {

	int w;
	int h;
	printf("κ°€λ‘œμ˜ 길이?");
	scanf_s("%d", &w);

	
	printf("μ„Έλ‘œμ˜ 길이?");
	scanf_s("%d", &h);
	printf("μ§μ‚¬κ°ν˜•μ˜ 넓이: %d\n",w*h);
	printf("μ§μ‚¬κ°ν˜•μ˜ λ‘˜λ ˆ: %d\n",(w+h)*2);
	return 0;
}​
//3
#include <stdio.h>
int main() {

	int m;
	int h;
	printf("μ§ˆλŸ‰(kg)?");
	scanf_s("%d", &m);

	printf("높이(m)?");
	scanf_s("%d", &h);

	printf("μœ„μΉ˜μ—λ„ˆμ§€: %f\n",9.8*m*h);


	return 0;
}
//4
#include <stdio.h>
int main() {

	float f;
	float s;
	printf("힘(N)?");
	scanf_s("%f",&f);

	printf("이동거리(m)?");
	scanf_s("%f",&s);

	printf("일의 μ–‘: %.2f J", (f * s));


	return 0;
}
//5
#include <stdio.h>
int main() {

	float c;
	printf("길이?");
	scanf_s("%f",&c);

	printf("%f inch = %f cm",c, c*2.54);


	return 0;
}

 

//6
#include <stdio.h>
int main() {

	float c;
	printf("μ•„νŒŒνŠΈμ˜ 면적(μ œκ³±λ―Έν„°)?");
	scanf_s("%f",&c);

	printf("%.2f μ œκ³±λ―Έν„° = %.2f 평",c, (c*0.3025));


	return 0;
}

 

//7
#include <stdio.h>
int main() {

	float a;
	printf("μ‹€μˆ˜?");
	scanf_s("%f",&a); //or %e

	printf("제곱 %e\n",a*a);
	printf("μ„Έμ œκ³± %e:",a*a*a);

	return 0;
}

 

//8
#include <stdio.h>
int main() {

	int a;
	printf("길이(yb)?");
	scanf_s("%d",&a);
	printf("%d μ•Όλ“œ = %fm",a,(a*0.9144));
	return 0;
}

 

//9
#include <stdio.h>
int main() {

	int a;
	printf("무게(ld)?");
	scanf_s("%d",&a);
	printf("%d ld = %f kg",a,(a*0.45359237));

	return 0;
}
//10
#include <stdio.h>
int main() {

	float a,b;
	printf("USD?");
	scanf_s("%f",&a);
	printf("원.λ‹¬λŸ¬ ν™˜μœ¨?");
	scanf_s("%f", &b);
	printf("USD %.2f = KRW %.2f",a,(a*b));

	return 0;
}

 

//11
#include <stdio.h>
int main() {
	float a,b;
	printf("KRW?");
	scanf_s("%f",&a);
	printf("원.λ‹¬λŸ¬ ν™˜μœ¨?");
	scanf_s("%f", &b);
	printf("KRW %.0f = USD %.2f",a,(a/b));

	return 0;
}