Ask Question, Ask an Expert

+1-415-315-9853

info@mywordsolution.com

Ask C/C++ Expert


Home >> C/C++

problem1)a) describe how you can print the following characters on the screen:

i) problem mark

ii) Horizontal tab

iii) Vertical tab

iv) Backslash

v) New line

vi) Backspace

b) Which of the following are valid integer constants? Give reasons for your answer.

i) 123456L

ii) 12.5

c) Which of the following are valid float constants? Give reasons for your answer.

i) 12345e-2

ii) -01234e-10

d) Which of the following are valid C identifiers? Give reasons for your answer.

i) one-two

ii) _ABC

iii) 3dimensional

problem2)a) What are the errors in the following C program?

1 # include
2 #define PI=3.14
3 int main()
4 {
5 float radius,area;
6 printf("Enter the radius\n"/*get radius*/);
7 scanf("%d",&radius);
8 area = PI*radius*radius;
9 printf("The Area is %f Km/hr.",Area);
10 return 0;
11 }

b) Arrange the operators in ascending order of priority:

i) +=,*,>>

ii) %,->,||

c) What is the type of the C expressions in the following fragment?
Int a, b;
char alpha, beta, gamma;
long x;
a*alpha-beta;
x*a+b;

problem3)a) prepare the C expressions for each of the following expressions:

i) 1/(√x2+y2)

ii) (x-1)/(x2+2)+(2x-1)/(x2- 4x+7)

iii) e-(x-a/b)^2

You can make use of the functions from the maths library.

b)

What do the following functions do? Justify your answer.

Int func1(floatx)

{
return((int)(x+1))
}
Int func2(intn)
{ int S = 0, i, m=0;
For (i = 0;i < n ;i++) {
m=m+2*i+1;
S=S+m;
}
return (S);
}

)

problem4)a) In the program fragment given below, what are the values of the expressions in line numbers 2, 4 and 5?

1 int x = 2, y = 2;
2 x ++ > y ? x + 1 : y + 1
3 x = 2, y = 2;
4 ++ x > x ? x:y;
5 ++ x*y --;

b) If you want to prepare a for() loop for printing the sum of all numbers from 1 to 100 which of the following for () loops will do the job? Give reasons for your answer.
For (sum=0,i=1; i <= 100; sum += i,++i)
;
For (sum=0,i=1,i <= 100; ++i, sum +=i)
;

c) prepare a function double trapezoid( double f(double x), int a, int b) which can be used to integrate using trapezoid rule any function that fits the prototype of the function. For ex, you should be able to find 0π/2 sin x dx by using a function call trapezoid(sin, 0,π/2).

C/C++, Programming

  • Category:- C/C++
  • Reference No.:- M92603

Have any Question? 


Related Questions in C/C++

Write a program that reads numbers from cin and then sums

Write a program that reads numbers from cin and then sums them, stopping when 0 has been entered. Construct three versions of this program, using the while, do - while , and for loops. Add the following to your program: ...

Assignmentthis assignment gives you the opportunity to

Assignment This assignment gives you the opportunity to practice array of pointers, linked lists and self referential structures. Write a program that initializes two parallel arrays as follows: char * String[] = { "Abbi ...

Modules in c are called functions c programs are typically

Modules in C are called functions. C programs are typically written by combining user created functions as well as "pre-packaged" functions found in the C Standard Library. For instance, printf() is a function that is fo ...

Programming cc assignmentsyoull need to download this to

Programming C/C++ assignments You'll need to download this To write the program. The programs will be written using the Microsoft Visual C++ Express Edition IDE (Integrated Development Environment), which can be download ...

C-programmingcreate a c program that sorts a sequence of

C-Programming Create a C program that sorts a sequence of positive numbers using the bubble sort algorithm in an increasing or decreasing order based on the user's choice. The pseudo code for the bubble sort algorithm is ...

Projectdecision statementsdirections read carefully and

Project: Decision Statements Directions (Read CAREFULLY and follow COMPLETELY): - Create the following programs in C++ that perform the purpose described and show the sample output (with user input where applicable). - I ...

Programming in cbubba tubs bbq rub is a company that makes

Programming in C++ Bubba Tub's BBQ Rub is a company that makes different BBQ dry rubs and sauces. They make each product when it is ordered with the freshest ingredients and sell it by the unit. A unit is 2 ounces of pro ...

Assignmentobjectivespractice reading characters from a

Assignment Objectives Practice reading characters from a file Practice using command line input Practice using command-line redirection of files Practice implementing a double transposition ciphering algorithm Summary In ...

Bankers algorithmimplement the bankers algorithm for

Banker's Algorithm Implement the Banker's algorithm for deadlock avoidance, that works on a given set of N processes and M resource types (N The input data and result is then displayed on the screen. You may use your pro ...

Write a c application that does the followingitem 1 prompts

Write a C++ application that does the following: ITEM 1: Prompts the user to choose one of the following series: 1 + 1/2 + 1/3 + ... + 1/n ((((x * 2) * 2) * ...) * 2) series of n multiplications x + (x * 1) + (x * 2) + ( ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

WalMart Identification of theory and critical discussion

Drawing on the prescribed text and/or relevant academic literature, produce a paper which discusses the nature of group

Section onea in an atwood machine suppose two objects of

SECTION ONE (a) In an Atwood Machine, suppose two objects of unequal mass are hung vertically over a frictionless

Part 1you work in hr for a company that operates a factory

Part 1: You work in HR for a company that operates a factory manufacturing fiberglass. There are several hundred empl

Details on advanced accounting paperthis paper is intended

DETAILS ON ADVANCED ACCOUNTING PAPER This paper is intended for students to apply the theoretical knowledge around ac

Create a provider database and related reports and queries

Create a provider database and related reports and queries to capture contact information for potential PC component pro