Already have an account? Get multiple benefits of using own account!
Login in your account..!
Remember me
Don't have an account? Create your account in less than a minutes,
Forgot password? how can I recover my password now!
Enter right registered email to receive password!
Aim: To implement a program to swap two numbers using reference arguments.
Code:
void swap(int *a, int *b)
{
int temp;
temp=*a;
*a=*b;
*b=temp;
}
void main()
int a,b;
clrscr();
cout<<"Program to swap two variables.";
cout<<"\nEnter variables:\nA:";
cin>>a;
cout<<"B:";
cin>>b;
swap(&a,&b);
cout<<"\nSwapped variables:\n\nA:"< cout<<"\nB:"< getch(); } Output: Program to swap two variables. Enter variables: A:5 B:36 Swapped variables: A:36 B:5
cout<<"\nB:"<
getch();
Output:
Program to swap two variables.
Enter variables:
A:5
B:36
Swapped variables:
A:36
B:5
Greatest Common Divisor (GCD) - The greatest common divisor (GCD) of two integers is the largest integer that will evenly divide both integers. The GCD algorithm involves intege
There is a pebble merchant. He sells the pebbles, that are used for shining the floor. His main duty is to take the length of the room’s sides. But he sometimes mistakes doing tha
Define Bitwise Left Shift and Right Shift Operators: >? The bitwise shift operators shift their first operand right (>>) or left ( // Illustration of the bitwise right shi
Question 1 / 1 You have an N x N chessboard and you wish to place N kings on it. Each row and column should contain exactly one king, and no two kings should attack each other (two
Objective: Construct a C program that controls the LCD display, and is capable of displaying strings. Add functions to the C program that allows more control over the display.
WAP TO PRINT SUM=1!+2!+3!+4!+....N! #include stdio.h> #include conio.h> void main() { int n,i; float sum=0,fac
Call by reference: Arguments to a function can be passed in two way; one by call by value and other by call by reference. Call by value is passed either through a constant
Define a function in c program: int f1() { static int x=10; return x; } int f2() { int y=5; return y; } extern int z; void f() {
Question 1 Implement a class stack which simulates the operations of the stack allowing LIFO operations. Also implement push and pop operations for the stack 2 Explain the c
Write a program to input two integers. If they are equal display "The numbers are equal". Otherwise display a message if the first is a multiple of the second or if it is not a mul
Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!
whatsapp: +91-977-207-8620
Phone: +91-977-207-8620
Email: [email protected]
All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd