Sunday 15 February 2015

c program for multiplication

c program two add two numbers

#include<stdio.h>
#include<math.h>
void main()
{
    int a[1000]={2,3},i,j=2,n;
    printf("enter the upper range of prime numbers \n");
    scanf("%d",&n);
    for(i=3;i<=n;i+=2)
    {   
        count=0;
        for(j=1;j<=sqrt(i);j++)
        {
            if(i%a[j]==0)
            {
                    count=-1;
                    continue;
            }
       
        }
        if(count!=-1)
        {
            printf("%d,",i);
            a[++j]=i;
        }
    }
   
}

Saturday 31 January 2015

c programming

c program to add two numbers


#include <stdio.h>
void main()
{
 int a,b,c;
 printf("enter your numbers ")
 scanf("%d %d",&a,&b);
 c=a+b;
 printf("the addition is %d",c); 
}
  

sample input enter your numbers: 5,7

sample output the addition is 12