About the modification of 30 arithmetic (modify subtraction to make it minuend greater than the meiosis)

Source: Internet
Author: User

#include "stdafx.h"
#include <stdio.h>
#include <stdlib.h>
int main (int argc, char* argv[])
{
int i,j,k,sum;
for (int t = 0;t<30;t++)
{
i = rand ()%50;
j = rand ()%50;
K = rand ()%4;
Switch (k)
{
Case 0:
sum = i+j;
printf ("Problem%d:", t+1);
printf ("%d+%d=%d\n", i,j,sum);
Break
Case 1:
if (I<J)
{
t = t-1;
Break
}
Else
{
sum = i-j;
printf ("Problem%d:", t+1);
printf ("%d-%d=%d\n", i,j,sum);
Break
}
Case 2:
sum = i*j;
printf ("Problem%d:", t+1);
printf ("%d*%d=%d\n", i,j,sum);
Break
Case 3:
sum = i/j;
printf ("Problem%d:", t+1);
printf ("%d/%d=%d\n", i,j,sum);
Break
Default
printf ("Error! \ n ");
Break
}
}
return 0;
}

Here, the answer to the operation is output directly on the screen, if you want to put the answer to the end, just create an array of integers sum[30], and the answer to each question there, the final output,

Here no more one by one details.

About the modification of 30 arithmetic (modify subtraction to make it minuend greater than the meiosis)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.