Hi!
I am working on a project and I am not taking modulus! The sign is "%" but it doesn t work! Take a look this,please!
if( (min+max)<21)
printf( "The modula is : %d\n",min+max);
if ((min+max)>=21)
printf("The modula is : %d % 21",min+max);
Of course it is not the whole code.I am trying to take modula21, but where is wrong???The whole code is
Code:
#include<stdio.h>
main()
{
int n,m,i,min,max;
printf("Please enter a positive integer:");
scanf("%d",&n);
printf("Enter integers:");
scanf("%d",&m);
max=m;
min=m;
for(i=2;i<=n;i++)
{
scanf("%d",&m);
if(m<min)
min=m;
if(m>max)
max=m;
}
printf("The smallest number is %d\nThe greatest number is %d\n",min,max);
printf("The sum is : %d\n",min+max);
if( (min+max)<21)
printf( "The modula is : %d\n",min+max);
if ((min+max)>=21)
printf("The modula is : %d % 6",min+max);
}