This program enables a user to input two values and it display the bigger one.
I used the if function to evaluate the two numbers
Source code:
#include <stdio.h>
int main (void)
{
int a,b;
puts("二数の大きい方を表示します。");
printf("整数1:"); scanf("%d", &a);
printf("整数2:"); scanf("%d", &b);
if(a>b)
printf("整数1のほうが大きいです。");
else
printf("整数2の方が大きいです。");
return(0);
}
I used the if function to evaluate the two numbers
Source code:
#include <stdio.h>
int main (void)
{
int a,b;
puts("二数の大きい方を表示します。");
printf("整数1:"); scanf("%d", &a);
printf("整数2:"); scanf("%d", &b);
if(a>b)
printf("整数1のほうが大きいです。");
else
printf("整数2の方が大きいです。");
return(0);
}

0 件のコメント:
コメントを投稿