#include #include int a,b,max; main() { printf("Which is max? "); printf("a:");scanf("d",&a); printf("b:");scanf("d",&b); max=a; if (max<b) max=b; printf("max is :%d",solon); getch() ; } Help me .....soon
there is no iostream.h in the c++ standard. and what do you need it for anyway? also the redundant "Max value is %d " is not nice.
: Hi, : : I have modified your code. This should work. : : [code] : #include : #include : #include : #include : : int main() : { : /* Declaring the numbers a and b */ : int a,b; : : printf("Which is max? "); : : /* User has to enter the value for a */ : printf("Input the value for a:"); : scanf("%d",&a); : : /* User has to enter the value for b */ : printf("Input the value for b:"); : scanf("%d",&b); : : /* An IF statement to determine the Max value, i.e., a or b */ : if (a < b){ : printf("Max value is %d ", b); : } : else{ : printf("Max value is %d ", a); : } : : system ("PAUSE"); : return 0; : } : [/code] : : Hope this helps, : :
Comments
: #include
: int a,b,max;
: main()
: {
: printf("Which is max?
");
: printf("a:");scanf("d",&a);
: printf("b:");scanf("d",&b);
: max=a;
: if (max<b)
: max=b;
: printf("max is :%d",solon);
: getch() ;
: }
: Help me .....soon
:
:
shouldn't
printf("a:");scanf("d",&a);
printf("b:");scanf("d",&b);
be
printf("a:");scanf("[b]%[/b]d",&a);
printf("b:");scanf("[b]%[/b]d",&b);
"Who is General Failure and why is he reading my hard disk?!"
I have modified your code. This should work.
[code]
#include
#include
#include
#include
int main()
{
/* Declaring the numbers a and b */
int a,b;
printf("Which is max?
");
/* User has to enter the value for a */
printf("Input the value for a:");
scanf("%d",&a);
/* User has to enter the value for b */
printf("Input the value for b:");
scanf("%d",&b);
/* An IF statement to determine the Max value, i.e., a or b */
if (a < b){
printf("Max value is %d
", b);
}
else{
printf("Max value is %d
", a);
}
system ("PAUSE");
return 0;
}
[/code]
Hope this helps,
" is not nice.
: Hi,
:
: I have modified your code. This should work.
:
: [code]
: #include
: #include
: #include
: #include
:
: int main()
: {
: /* Declaring the numbers a and b */
: int a,b;
:
: printf("Which is max?
");
:
: /* User has to enter the value for a */
: printf("Input the value for a:");
: scanf("%d",&a);
:
: /* User has to enter the value for b */
: printf("Input the value for b:");
: scanf("%d",&b);
:
: /* An IF statement to determine the Max value, i.e., a or b */
: if (a < b){
: printf("Max value is %d
", b);
: }
: else{
: printf("Max value is %d
", a);
: }
:
: system ("PAUSE");
: return 0;
: }
: [/code]
:
: Hope this helps,
:
:
[code]
#include
#include
#include
int main()
{
/* Declaring the numbers a and b */
int a,b;
printf("Which is max?
");
/* User has to enter the value for a */
printf("Input the value for a:");
scanf("%d",&a);
/* User has to enter the value for b */
printf("Input the value for b:");
scanf("%d",&b);
/* An IF statement to determine the Max value, i.e., a or b */
if (a < b){
printf("Max value is %d
", b);
}
else{
printf("Max value is %d
", a);
}
system ("PAUSE");
return 0;
}
[/code]