Dear All,
Please help me regarding this C++ Assignment.
Q.1
Write a program using malloc function. In which you take input from user and allocate memory equal to square of this number. Which multiply numbers and draw a table in the following format?

Hint: User enters 3 then program allocates equal to 9 integer memories.

Output:1

Enter a single digit number:
2
The multiplication table of 2 is:
1 2
----------------
1| 1 2
2| 2 4

Output:2

Enter a single digit number:
4
The multiplication table of 4 is:
1 2 3 4
--------------------------------
1| 1 2 3 4
2| 2 4 6 8
3| 3 6 9 12
4| 4 8 12 16

Q.2
Write a macros in which swap two number without using 3rd variable and then call
Macro in main function.

Hint: a=4, b=2 after swapping a=2, b=4.

Recommended Answers

All 2 Replies

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.