Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

Department of CS and IT

Project Based Learning


Team Details

A Project report is submitted in partial fulfilment of the requirements of the


Programing in C

STUDENT’S NAME :------------------------------------------------------------------


USN/ENROLMENT NO :------------------------------------------------------------------
STUDENT’S NAME :------------------------------------------------------------------
USN/ENROLMENT NO :------------------------------------------------------------------
STUDENT’S NAME :------------------------------------------------------------------USN/
ENROLMENT NO :------------------------------------------------------------------
CLASS/SECTION :----------------------------------SEMESTER :------------------
SUBJECT :-----------------------------------------------------------------
TOPIC OF THE
PROJECT :--------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------
DATE OF ASSIGNMENT :-----------------------------------------------------------------
DATE OF SUBMISSION :-----------------------------------------------------------------
MARKS ALLOTED :------------------------------------------------------------------
UNDER THE SUPERVISION OF :------------------------------------------------------

____________________ ___________________
STUDENT’S SIGNATURE SUPERVISOR SIGNATURE

1) Swap two numbers without using third variable.

There are 2 Different ways by which we can swap two numbers without using 3rd
variable

Program 1 :
#include<stdio.h>  
 int main()    
{    
int a, b;
scanf(“%d %d”,&a,&b);      
printf("Before swap a=%d b=%d",a,b);      
a=a+b;    
b=a-b;    
a=a-b;  
printf("\nAfter swap a=%d b=%d",a,b);    
return 0;  
}   
OUTPUT 1

Program 2 :
#include<stdio.h>  
#include<stdlib.h>  
 int main()    
{    
int a, b;      
scanf(“%d %d”,&a,&b);
printf("Before swap a=%d b=%d",a,b);       
a=a*b;//a=200 (10*20)    
b=a/b;//b=10 (200/20)    
a=a/b;//a=20 (200/10)     
printf("\nAfter swap a=%d b=%d",a,b);       
return 0;  
}   
OUTPUT 2

Program 3 :
#include<stdio.h>
int main()
{
int a, b;
scanf(“%d %d”, &a, &b);
printf(“Before swap a=%d b=%d”, a,b);
printf(“\n After swap b=%d a=%d”, b, a);
return 0;
}

OUTPUT 3

You might also like