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;
}
Q2
#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;
}
IN C 4) Convert the following mathematical formula to a C code, where Z, a, b...
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 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 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 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 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 and displays the number in reverse order.
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 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 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 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)...