Question

4) Convert the following mathematical formula to a C code, where Z, a, b and c are doubles (You do not need to write the whole program, just write the code fragment) Z-a + sqrt(b+3 5-2)/(c 5)*3 mod 5 5) Write a program that prompts the user to enter an integer number (N) and then displays the following (2N+1)-by-(2N+1) pattern like the one below Enter a number: 4

IN C

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Q1.

#include <stdio.h>
#include<math.h>

int main()
{
float a,b,c ,Z,k,l,h,t,k;
int m;
printf("Enetr the valuesof a,b and c");
scanf("%f %f %f",&a,&b,&c);
t=(b+3*5-2);
k=sqrt(t);
l=((c*5)*(c*5)*(c*5));
m=k/l;
h=m%5;
Z=a+h;
printf("%f",Z);
  return 0;
}

Q2f Facebook ← → https://www.tutorialspoint.com/compile_c-online.php : Apps NewTab Google Web Slice GalleryImported From IE × M Inbox (27,362) . poojajir X inbox (49) yog forcheg × INC I Chegg.com × 四 My Jeevansathi-Jeevar × < > Online C Compiler . On Virtual Learning-OnNew folder CMSC 451 Lecture 5 1on 1 Soccer-Unbl Homeo Other bookmarks codingground compile and Execute c online (GNu GCC V7.1.1) Fork a Project 3 Edit ▼ * Setting ▼ Login %Execute il > share main. STOIN l Result #include <stdio.h> Secc -o main *.< 3 int main() Enter the volue of n int i,j,n,p,q; printf(Enter the value of n); scanf,&n); 8 printf(In); q-2 n+1; /louter Loop fron 1 to9 for(i-1;i<-p;i++) 12 14 15 // Inner Loop also from I to 9 for(j-1;j-qijt) 17 //讠f 1 and j are equal if((i--j) | | (İtj--p+1)) ; and itj-p+1 printf() 25 printf(); 28 29 printf(\n; 31 32 return 0; 9:24 PM ) !乍 11/15/2018

#include <stdio.h>

int main()
{
int i,j,n,p,q;
printf("Enter the value of n");
scanf("%d",&n);
printf("\n");
p=2*n+1;
q=2*n+1;
//outer loop from 1 to 9
for(i=1;i<=p;i++)
{
// Inner loop also from 1 to 9
for(j=1;j<=q;j++)
{
// if i and j are equal ; and i+j=p+1
if((i==j)||(i+j==p+1))
{
printf("* ");
}
  
else
{
printf(". ");
}
}
printf("\n");
}
  
return 0;

}

Add a comment
Know the answer?
Add Answer to:
IN C 4) Convert the following mathematical formula to a C code, where Z, a, b...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Use a C++ program to run your code that prompts the user to enter an integer,...

    Use a C++ program to run your code that prompts the user to enter an integer, greater or equal to 2, and displays its largest factor other than itself. To answer for this question, It is required that you use following two functions to complete the assignment. a.     // Prompts the user to enter an integer: number >=2         void getNumber( int& number); b.     // returns the largest factor of n other than itself         int getLargestNonSelfFactor(int n);

  • USING PYTHON LANGUAGE. QUESTION I: Write a program that displays the following table: a a^2 a...

    USING PYTHON LANGUAGE. QUESTION I: Write a program that displays the following table: a a^2 a 3 a14 1 1 1 1 2 4 8 16 3 9 27 81 4 16 64 256 QUESTION II: An approximate value of a number can be computed using the following formula: 7 ) Write a program that displays the result of 4 X + 7 • H) and 4 X - 를 7 tis). 9 QUESTION III: Write a program that prompts...

  • 3) What are the final values of a, b, c in the following code fragment (1.5...

    3) What are the final values of a, b, c in the following code fragment (1.5 point): int a = 6 , b = 127 , c; c = ( ++a ) + ( b -- ); Answer: 4) What are the final values of a, b, c in the following code fragment (1.5 point): int a = 6 , b = 127 , c; c = (a++) + ( -- b); Answer: 5) What is displayed by this poorly...

  • In C, write a program to convert a char (0-9) to Dec (ASCII value). Then convert...

    In C, write a program to convert a char (0-9) to Dec (ASCII value). Then convert an ASCII Value to char -------+ | ASCII CODE | + - ---+ +-- | char | Dec | ----+ | 'O' => 48 | | '1' => 49 | '2' => 50 | '3' => 51 | | '4' => 52 | | '5' => 53 | '6' => 54 | | '7' => 55 | | '8' => 56 | | '9'...

  • please write psedocodes for all of the questions and an algorithm for 2. no coding is...

    please write psedocodes for all of the questions and an algorithm for 2. no coding is required . FIUJELI 95 PIOL 1. (Geometry: Area of a Pentagon) Write a C# program that prompts the user to enter the length from the center of a pentagon to a vertex and computes the area of the pentagon, as shown in the following figure. The formula for computing the area of a pentagon is Area = 2 , where s is the length...

  • In c++ please .. Write a program that prompts the user to enter a four-digit integer...

    In c++ please .. Write a program that prompts the user to enter a four-digit integer and displays the number in reverse order.

  • C++ Write a program that prompts the user to enter integers or a sentinel to stop....

    C++ Write a program that prompts the user to enter integers or a sentinel to stop. The program prints the highest and lowest numbers entered, the sum and the average. DO NOT USE ARRAYS, only variables and loops. Write a program the prompts the user to input a positive integer. Keep asking the user until a positive integer is entered. Once a positive integer is entered, print a message if the integer is prime or not. (NOTE: A number is...

  • Convert the following C fragment to equivalent MIPS assembly language Write mini calculator that take two...

    Convert the following C fragment to equivalent MIPS assembly language Write mini calculator that take two integer numbers as input and ask the user if he need to compute addition, subtraction, remainder, division, or multiplication then print the result. Hint: you can give each operation a special number. For example, the addition (1), subtraction (2), …. And so on. The output must be something like: Enter the first integer number: 5 Enter the second integer number: 3 Which operation? 1...

  • Please write code in C++ and include all headers not bits/stdc: 17.10 (Occurrences of a specified...

    Please write code in C++ and include all headers not bits/stdc: 17.10 (Occurrences of a specified character in a string) Write a recursive function that finds the number of occurrences of a specified letter in a string using the following function header. int count(const string& s, char a) For example, count("Welcome", 'e') returns 2. Write a test program that prompts the user to enter a string and a character, and displays the number of occurrences for the character in the...

  • Please show screenshot outputs and fully functional code for the Java programs. Question 1: Write a...

    Please show screenshot outputs and fully functional code for the Java programs. Question 1: Write a method that computes and returns the area of a square using the following header: public static double area ( double side) Write a main method that prompts the user to enter the side of a square, calls the area method then displays the area. Question 1a: Write a method that converts miles to kilometers using the following header: public static double convertToKilometers (double miles)...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT