64 617
Assignments Done
99,1%
Successfully Done
In September 2018

Answer to Question #3230 in C++ for vivek

Question #3230
Write a program generates three single-digit integers and prompts the user to enter the lowest of
these three. The program then reports true if the answer is correct, false otherwise
Expert's answer
#include<stdio.h>
#include<stdlib.h>

int main()
{
& int a,b,c, m, k;
& // generate random digits
& a=rand()%10;
& b=rand()%10;
& c=rand()%10;
& // calculate minimum of a,b,c
& m = (a<b) ? a : b;
& if (c<m) { m=c; };
&
& printf("Please enter minimum of the following numbers a,b,c:\n");
& printf("a=%d, b=%d, c=%d\n", a,b,c);
& scanf("%d",&k);
&
& if(k==m)
& {
printf("Your answer is correct!\n");
& }
& else
& {
printf("Your answer is not correct!\n");
& };
& return 0;
};

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions