Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program to produce the following output on the screen. Write a program t

ID: 3781734 • Letter: W

Question

Write a program to produce the following output on the screen. Write a program to produce the following output on the screen using only one printf() function for each figure. Write a program to ask the user to input a floating point number between -99.9 and 99.9. The number should be stored in a variable labeled num. The output should then be displayed as shown below with 'x' replaced by the entered number, including one digit after the decimal point. The format and justifications should be as shown with the vertical lines m the same positions, regardless of the value entered.

Explanation / Answer

1)

#include<stdio.h>
#include<conio.h>
int main()
{

   printf("%.2f%4s|%2s%llu| ",123.45,"","",4815162342);
   printf("%4s%.2f|%.5f%3s%s| ","",-24.0,3.14159,"","pi");
   printf("%10s|%s%3s%d| ","",""abc"","",123);

}

2)

a)

#include<stdio.h>

int main() {
char ch = '*';
int i, j, sp = 2, sc;

for (i = 1; i <= 3; i++) {
for (sc = sp; sc >= 1; sc--) {
printf(" ");
}

for (j = 1; j <= i; j++) {
printf("%2c", ch);
}

printf(" ");
sp--;
}
return 0;
}

b)

#include <stdio.h>

int main()
{
int i, j, n;


n=5;

for(i=1; i<=n; i++)
{
  
for(j=i; j<n; j++)
{
printf("a");
}

  
for(j=1; j<=(2*i-1); j++)
{
if(i==n || j==1 || j==(2*i-1))
{
printf("*");
}
else
{
printf(" ");
}
  
}

printf(" ");
}

return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote