Docsity

Arithmetic Problems-Computer Fundamentals-Lab Codes, Exercises of Computer Fundamentals

Toggle sidebar
bg1
/*In the very first step of program,the library will be included which
will contain necessary information of commands i used in the program.*/
#include<stdio.h>
/*second step is the declaration ,that main function of the program is
integeer type function*/
int main()
/*the program is written in the middle brackets{}*/
{
/*it is the declaration that variables a and b are integer type*/
float a,b;
/*topic of program*/
printf("SWAPPING OF GIVEN INPUTS\n\n\n");
/*by this printf command user will be able to know that he has to enter
input here*/
printf ("please input a and b\na=");
scanf("%f",&a);
printf("b=");
scanf("%f",&b);
/*following three steps will swap the values of a and b*/
a=a-b;
b=b+a;
a=b-a;
/*here the output of the program will be displayed*/
printf("the values of a and b are swapped as
follows\na=%.3f\nb=%.3f\n",a,b);
return 0;
/*following bracket indicates the termination of program and it makes the
pair with the first bracket we used in our program*/
}
docsity.com

Partial preview of the text

Download Arithmetic Problems-Computer Fundamentals-Lab Codes and more Exercises Computer Fundamentals in PDF only on Docsity!

/In the very first step of program,the library will be included which will contain necessary information of commands i used in the program./

#include<stdio.h>

/second step is the declaration ,that main function of the program is integeer type function/

int main()

/the program is written in the middle brackets{}/

{

/it is the declaration that variables a and b are integer type/

float a,b;

/topic of program/

printf("SWAPPING OF GIVEN INPUTS\n\n\n");

/by this printf command user will be able to know that he has to enter input here/

printf ("please input a and b\na="); scanf("%f",&a); printf("b="); scanf("%f",&b);

/following three steps will swap the values of a and b/

a=a-b; b=b+a; a=b-a;

/here the output of the program will be displayed/

printf("the values of a and b are swapped as follows\na=%.3f\nb=%.3f\n",a,b); return 0;

/following bracket indicates the termination of program and it makes the pair with the first bracket we used in our program/

}

docsity.com