include
#include
void main()
{
int x, y, temp;
printf("Enter the value of x and y ");
scanf("d", &x, &y);
printf("Before Swapping x = %d\ny = %d\n",x,y);
temp = x;
x = y;
y = temp;
printf("After Swapping x = %d\ny = %d\n",x,y);
getch();
return 0;
}
Do you happen to know what a flow-chart is?
pictorial representation of a program is called a flowchart
To swap two variables using a third variable in a flowchart, start with the initial values of the two variables, say A and B. Use a third variable, C, to temporarily hold the value of A (C = A). Next, assign the value of B to A (A = B), and finally, assign the value of C back to B (B = C). This sequence effectively swaps the values of A and B.
In a flowchart, a variable is typically represented as a symbol that denotes a value or data element that can change during the execution of a process. It serves as a placeholder for information that can be manipulated or referenced throughout the flow of the algorithm. Variables are often depicted using parallelograms or rectangles, depending on the flowchart conventions, to indicate their role in the process.
low level and high level
#include<stdio.h> void main() { int a=2,b=4; printf("Program for swapping two numbers "); printf("Numbers before swapping"); printf("a=%d and b=%d",a,b); a=((a+b)-(b=a)); printf("Numbers after swapping"); printf("a=%d and b=%d",a,b); getch(); }
Nothing. Never do that.
It means that you swap the values of that variables EX: -==- before swapping :- Variable1 = 5; variable2 = 10; after swapping :- Variable1 = 10; variable2 = 5;
A manual flowchart is static. The advantage of an interactive Visual Logic flowchart is that it allows users to input values for various variables at runtime. When the flowchart is finished, users can then run the program behind the chart.
pictorial representation of a program is called a flowchart
To design a flowchart for inputting two numbers and swapping their values, start with a terminal symbol indicating the start. Next, use input/output symbols to prompt the user to enter the two numbers, labeling them as A and B. Then, employ a process symbol to perform the swap, which can be done using a temporary variable, such as: temp = A; A = B; B = temp. Finally, use another input/output symbol to display the swapped values of A and B, and end the flowchart with a terminal symbol.
ghjukkghhgyg
[object Object]
Swapping means to swap the values of two addresses in main memory.
it's like a family tree, yourself, then flows to two parents, then flows to their 4 parents, and on and on. in otherwords, a flowchart
In a flowchart, a variable is typically represented as a symbol that denotes a value or data element that can change during the execution of a process. It serves as a placeholder for information that can be manipulated or referenced throughout the flow of the algorithm. Variables are often depicted using parallelograms or rectangles, depending on the flowchart conventions, to indicate their role in the process.
low level and high level
#include<stdio.h> void main() { int a=2,b=4; printf("Program for swapping two numbers "); printf("Numbers before swapping"); printf("a=%d and b=%d",a,b); a=((a+b)-(b=a)); printf("Numbers after swapping"); printf("a=%d and b=%d",a,b); getch(); }