/* test.c */
#include <stdio.h>
void main()
{
int a;/* 피연산자 1 */
int b;/* 피연산자 2 */
a = 8;
b = 4;
printf("[더하기] %d = %d + %d\n", a+b, a, b);
printf("[빼기] %d = %d - %d\n", a-b, a, b);
printf("[곱하기] %d = %d * %d\n", a*b, a, b);
printf("[나누기] %d = %d / %d\n", a/b, a, b);
}
/* T.java: 자바도 1.5 부터는 이제 c의 printf.. 지원.. */
public class T
{
public static void main(String [] args)
{
int a;/* 피연산자 1 */
int b;/* 피연산자 2 */
a = 8;
b = 4;
System.out.printf("[더하기] %d = %d + %d\n", a+b, a, b);
System.out.printf("[빼기] %d = %d - %d\n", a-b, a, b);
System.out.printf("[곱하기] %d = %d * %d\n", a*b, a, b);
System.out.printf("[나누기] %d = %d / %d\n", a/b, a, b);
}
};
===============================================================================
>사칙연산을 하려고 하는데
>
>어떻게 하죠?
>
>예를들어 곱하기를 하려고 하면
>
>자료형 2개만 놓고 서로 계산 시키려면?
>
>또는 나누기, 더하기, 빼기 등을 하려면?
>
>
>
>
>ㅂㅌㅈ
=============================================================================== |