Showing posts with label C Programs. Show all posts
Showing posts with label C Programs. Show all posts

Tuesday, 21 August 2012




#include<stdio.h>
void calc();
int main(void)
{
calc();
}
void calc()
{
int a,b,c;
printf("1.sum\n2.difference\n3.product\n4.quotient\n5.remainder  \n Enter the choice  .....   ");
scanf("%d",&c);
printf("enter the no:s");
scanf("%d%d",&a,&b);
delay(1000);
if(c==1)
printf("sum=%d",a+b);
if(c==2)
printf("diffrence=%d",a-b);
if(c==3)
printf("product=%d",a*b);
if(c==4)
printf("quotient=%d",a/b);
if(c==5)
printf("remainder=%d",a%b);


}



Saturday, 9 June 2012

C Program for Simple Calculator

Posted by Unknown On 12:48 | No comments

#include<stdio.h>
void calc();
int main(void)
{
calc();
}
void calc()
{
int a,b,c;
printf("1.sum\n2.difference\n3.product\n4.quotient\n5.remainder  \n Enter the choice  .....   ");
scanf("%d",&c);
printf("enter the no:s");
scanf("%d%d",&a,&b);
delay(1000);
if(c==1)
printf("sum=%d",a+b);
if(c==2)
printf("diffrence=%d",a-b);
if(c==3)
printf("product=%d",a*b);
if(c==4)
printf("quotient=%d",a/b);
if(c==5)
printf("remainder=%d",a%b);


}


C Program To Generate Unit Matrix

Posted by Unknown On 11:49 | 1 comment

#include<stdio.h>
main()
{
int a[10][10],i,j,m,n;
printf("\nEnter the order:");
scanf("%d%d",&m,&n);
printf("\nEnter the elements:");
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
scanf("%d",&a[i][j]);
}
}

C Program To Find LCM of Two Numbers

Posted by Unknown On 11:17 | No comments
#include<stdio.h>
void lcm();
int main(void)
{
lcm();
}
void lcm()
{
int a,b,i;
printf("enter the no:s");
scanf("%d%d",&a,&b);
for(i=2;i<=(a*b);i++)
{
#include<stdio.h>
int fib(int n)
{
int s;
if(n<2)
{
s=n;
return s;
}
else
s=fib(n-1)+fib(n-2);
return s;
}
int main()
{
int n;

#include<stdio.h>
int fact(int a)
{
 int f;
if(a==0)
return 1;
else
f=fact(a-1)*a;
return f;
}

Blogroll

Blogger templates

About