1. Write a program to add two no. 3 and 37.
The most basic of program is adding two no.'s when the no.'s are given.Here the numbers are 3 and 37. So, the result should show 40 as its answer. So, lets start...
#include<stdio.h> /*invoking first header file(compulsory)*/
#include<conio.h> /*invoking second header file(compulsory if you want to see the output)*/
main() /*to write the logic of adding*/
{ /*for the body of the logic of the main() function*/
int a=3,b=37,c; /* or taking the variables and supplying some with given values*/
c=a+b; /*for carrying out the sum*/
printf("The sum of 3 and 37 is: %d",c); /*for the printing of result*/
getch(); /*for getting the output to be displayed*/
} /*ending the epic addition procedure*/
This is just a small program of how to add two no. The basic step is here and gradually the level of programming gets tougher. The best and easiest way to understand a program is to understand the logic because most programs have common initial and final statements. The logic changes just!
The most basic of program is adding two no.'s when the no.'s are given.Here the numbers are 3 and 37. So, the result should show 40 as its answer. So, lets start...
#include<stdio.h> /*invoking first header file(compulsory)*/
#include<conio.h> /*invoking second header file(compulsory if you want to see the output)*/
main() /*to write the logic of adding*/
{ /*for the body of the logic of the main() function*/
int a=3,b=37,c; /* or taking the variables and supplying some with given values*/
c=a+b; /*for carrying out the sum*/
printf("The sum of 3 and 37 is: %d",c); /*for the printing of result*/
getch(); /*for getting the output to be displayed*/
} /*ending the epic addition procedure*/
This is just a small program of how to add two no. The basic step is here and gradually the level of programming gets tougher. The best and easiest way to understand a program is to understand the logic because most programs have common initial and final statements. The logic changes just!