write a program to swap Two numbers without using temp variable.

Answer Posted / rani

#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
printf ("enter the values to a & b");
scanf("%d%d",&a,&b);
a=a+b;
b=a-b;
a=a-b;
printf("%d%d",a,b);
}

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do we open a binary file in Read/Write mode in C?

963


What are pointers? Why are they used?

847


When should a type cast not be used?

826


Can we add pointers together?

814


what are the advantages of a macro over a function?

866


Can you return null in c?

854


What are qualifiers?

798


a single linked list consists of nodes a to z .print the nodes in reverse order from z to a using recursion

2557


Explain the difference between the local variable and global variable in c?

827


What is the symbol indicated the c-preprocessor?

934


Can you please explain the difference between malloc() and calloc() function?

863


What does %c do in c?

780


What is 2 d array in c?

753


What is the difference between typedef struct and struct?

830


The purpose of this exercise is to benchmark file writing and reading speed. This exercise is divided into two parts. a). Write a file character by character such that the total file size becomes approximately >10K. After writing close the file handler, open a new stream and read the file character by character. Record both times. Execute this exercise at least 4 times b). Create a buffer capable of storing 100 characters. Now after generating the characters, first store them in the buffer. Once the buffer is filled up, store all the elements in the file. Repeat the process until the total file size becomes approximately >10K.While reading read a while line, store it in buffer and once buffer gets filled up, display the whole buffer. Repeat the exercise at least 4 times with different size of buffer (50, 100, 150 …). Records the times. c). Do an analysis of the differences in times and submit it in class.

1828