swap prog
Answers were Sorted based on User's Feedback
/* u r question is not clear but i proceed it as a swap of
two numbers*/
main()
{
int a,b,temp;
clrscr();
printf("enter two no's");
scanf("%d %d",&a,&b);
temp=a;
a=b;
b=temp;
printf("after swap no are:");
printf("%d %d" ,a,b);
getch();
} venugopal.palavalasa@gmail.com
}
Is This Answer Correct ? | 5 Yes | 0 No |
Answer / tayyab
By using recent two variables swap code will be
a=3;
b=5;
a=a+b; a=8
b=a-b; b=3
a=a-b; a=5
Is This Answer Correct ? | 6 Yes | 1 No |
Answer / ksrikar
a=9;
b=5;
a=a*b; // a=45
b=a/b; // b=9
a=a/b; // a=5
Is This Answer Correct ? | 3 Yes | 0 No |
write a function that reverse the elements of an array in place.The function must accept only one pointer value and return void.
write a program that reverses the input number of n.Formulate an equation to come up with the answer.
Display Pattern: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 …
PROBLEM #8 The cashier at the counter of a Super Store, Mr. Khazaanchi has the following bundles of rupee cash notes with him: Rs. 1, 2, 5, 10, 50, 100, 500, 1000 A customer comes at his counter with various items that he has shopped. Mr. Khazaanchi totals the item prices and tells the customer his total amount payable. The customer gives Mr. Khazanchi some amount of cash. Find the total number of rupee notes of each denomination (i.e. 1, 2, 5, 10, 50, 100, 500, 1000) Mr. Khazaanchi will have to give to the withdrawer ensuring that the total number of rupee notes are minimum.
How reader and writer problem was implemented and come up with effective solution for reader and writer problem in case we have n readers and 1 writer.
Perform the functionality of 2-D array through 1-D array and in it the functions to be performed were: (1) Display the array in 2-D format (2) Display a particular element (3) Display a particular row (4) Display a particular column
Deriving time complexity of Binary tree and AVL tree, step by step.
output for printf("printf");
What is the time complexity T(n) of the following program? a) int n, d, i, j; cin >> n; for (d=1; d<=n; d++) for (i=1; i<=d; i++) for (j=1; j<=n; j += n/10) cout << d << " " << i << " " << j << endl; b) void main() { int n, s, t; cin >> n; for (s = 1; s <= n/4; s++) {t = s; while (t >= 1) { cout << s << " " << t << endl; t--; } } } c) void main() { int n, r, s, t; cin >> n; for (r = 2; r <= n; r = r * 2) for (s = 1; s <= n/4; s++) { t = s; while (t >= 1) { cout << s << " " << t << endl; t--; } } }
3 Answers CTS, IBM, Infosys, Qatar University,
How can I Draw an ellipse in 3d space and color it by using graph3d?
solve the problem in the programming language C++"if a five digit number is input through the keyboard.Write a program to calculate the sum of its digits(hint: use the modulus operator)
Write a program that print in screen a tree with its height taken from user by entering number of 4 digits and find the odd numbers then calculate the sum of odd numbers so he get the height of tree?