Q1: (Formatting Code) (10 points) Level Easy: The C programming language general
ID: 3877328 • Letter: Q
Question
Q1: (Formatting Code) (10 points) Level Easy: The C programming language generally ignores whitespace when coding. The following program can be copied (cut-n-pasted) into REPL and run: include cstdio.h> int main (void) int numberl, number2: printf"s" "Enter two integerS:"scanf("d d, &number;, number2) if (numberl number2)printf(id is larger.n" numberl): f (number2> numberi) printf("d is Larger.n", number2) puts ("These nunbers are equal.") return 0: /7 end function main (number1 umber2) a. It should produce the following output. Enter two integers: 10 12 12 is larger.Explanation / Answer
Q1 In this the code has already been provided and you just have to indent it so that it becomes more readable for that you can see that you make a new line after each { and use tab for in front of each statement
Q2
The corrected code would be
#include <stdio.h>
int main(void)
{
int radius;
printf("Enter the radius as an integer");
scanf("%d",&radius);
printf("For a circle with radius %d ",radius);
printf("Diameter= %d ",radius*2);
printf("Circumfrence=%f ",2*3.14159*radius);
printf("Area=%f ",3.14159*radius*radius);
return 0;
}
Q4
#include <stdio.h>
int main(void)
{
int n,m;
printf("Enter two integers ");
scanf("%d %d",&n,&m);
if(n>0)
printf("C");
else
{
if(n-m<0 && n>13)
printf("B");
else
printf("A");
}
return 0;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.