8 Nov 2013

c program for programmers - 2



using math .h 

#include "stdio.h"
#include "math.h"
void main ( )
{
int a,b,c;
a= 10;
b=20;
c=a+b;
printf("sum=%d\n",c);
getchar( );
}
output
sum=30

note : 
  1. you  can  change  the  operator  symbol  like + : add , - :subtract ,  / : divide ,                                    * :  multiplication ; ^:exportation.
  2. if you want to write the numbers in decimals write for int write float in printf for %d write %f

No comments:

Post a Comment