write a program to swap two variables a=5 , b= 10 without
using third variable
Answer Posted / nagendra kumar
#include<stdio.h>
main(){
int a,b;
printf("Enter A value: ");
scanf("%d",&a);
printf("\nEnter B value: ");
scanf("%d",&b);
printf("\nThe value of A is:%d",a);
printf("\n The value of B is:%d",b);
a=(a+b)-(b=a);
printf("\n The value of A is:%d",a);
printf("\n The value of B is:%d",b);
}
| Is This Answer Correct ? | 4 Yes | 2 No |
Post New Answer View All Answers
Explain is it better to use a pointer to navigate an array of values, or is it better to use a subscripted array name?
"%u" unsigned integer print the a) address of variable b) value of variable c) name of a variable d) none of the above
When should structures be passed by values or by references?
Write a code to remove duplicates in a string.
How can I read data from data files with particular formats?
What does the file stdio.h contain?
List some of the dynamic data structures in C?
Explain the meaning of keyword 'extern' in a function declaration.
Is it acceptable to declare/define a variable in a c header?
How are portions of a program disabled in demo versions?
Which one to choose from 'initialization lists' or 'assignment', for the use in the constructor?
Sir,please help me out with the code of this question. Write an interactive C program that will encode or decode multiple lines of text. Store the encoded text within a data file, so that it can be retrieved and decoded at any time. The program should include the following features: (a) Enter text from the keyboard, encode the text and store the encoded text in a data file. (b) Retrieve the encoded text and display it in its encoded form. (c) Retrieve the encoded text, decode it and then display the decoded text. (d) End the computation. Test the program using several lines of text of your choice.
What is header file in c?
Explain Basic concepts of C language?
What is the difference between typedef struct and struct?