## Pages

### C Program Finding Type of Triangle.

This Program is for identifying the type of triangle using C program. This is a part of Mumbai University MCA Colleges  C Programs MCA Sem 1

#include<stdio.h>
#include<conio.h>
void main()
{
float s1,s2,s3;
clrscr();
printf("Enter the sides of the triangle\n");
scanf("%f %f %f",&s1,&s2,&s3);
if((s1+s2<s3) || (s1+s3<s2) || (s2+s3<s1))
{
printf("It is not a valid triangle");
}
else
{
if(s1==s2 && s2==s3 && s1==s3)
{
printf("Its a equilateral triangle");
}
else if(s1==s2 || s2==s3 || s3==s1)
{
printf("Its a isoceles triangle");
}
else if(s1!=s2 || s2!=s3 || s3!=s1)
{
printf("The triangle is scalene triangle");
}

if(((s1*s1)+(s2*s2)==(s3*s3)) || ((s1*s1)+(s3*s3)==(s2*s2)) || ((s3*s3)+(s2*s2)==(s1*s1)))
{
printf("\nIts also a Right angeled triangle");
}
}

getch();
}

Hope this Program is useful to you in some sense or other. Keep on following this blog for more Mumbai University MCA College Programs. Happy Programming and Studying.

### C Program Fibonacci with Static Variable

This program is for Fibonacci Series using a Static variable. This is a part of Mumbai University MCA Colleges C Programs MCA Sem 1

#include<stdio.h>
#include<conio.h>
void fib();
void main()
{
int n,i;
clrscr();
printf("Enter the times you want the series\t");
scanf("%d",&n);
for(i=0;i<n;i++)
{
fib();
}
getch();
}

void fib()
{
static int a=0,b=1,c;
if(a==0)
printf("%d\t%d",a,b);
c=a+b;
a=b;
b=c;
printf("\t%d",c);
}

Hope this Program is useful to you in some sense or other. Keep on following this blog for more Mumbai University MCA College Programs. Happy Programming and Studying.

### C Program Sorting of Array

This is a simple program to sort a array. This is a part of Mumbai University MCA Colleges C Programs MCA Sem 1

#include<conio.h>
#include<stdio.h>
void main()
{
int a,i,j,n,temp;
clrscr();
printf("\n Enter the number of elements to sort");
scanf("%d",&n);
printf("\n Enter the elements  in the array");

for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
printf("Array in sorted form is as follows ");
for(i=0;i<n;i++)
{
for(j=0;j<(n-1-i);j++)
{
if(a[j]>a[j+1])
{
temp=a[j];
a[j]=a[j+1];
a[j+1]=temp;
//a[j]=(a[j]>a[j+1])?a[j]:a[j+1];
}
}
}
for(i=0;i<n;i++)
{
printf("%d \t",a[i]);
}
getch();
}

Hope this Program is useful to you in some sense or other. Keep on following this blog for more Mumbai University MCA College Programs. Happy Programming and Studying.

### C Programs Searching Element in Array

This program is for searching a element with a array. This is a part of Mumbai University MCA Colleges C Programs MCA Sem 1
#include<conio.h>
#include<stdio.h>
#define size 100
void main()
{
int ar[size],i,n,key,found=0;
clrscr();
li:
printf("\nEnter the size of array");
scanf("%d",&n);
if((n<1)||(n>=size))
{
printf("\nArray size is invalid");
goto li;
}
printf("\nEnter the elements in array");
for(i=0;i<n;i++)
{
scanf("%d",&ar[i]);
}
printf("\nEnter the key number to search");
scanf("%d",&key);
for(i=0;i<n;i++)
{
if(ar[i]==key)
{
printf("\nThe key %d is found at position %d in the Array",key,i);
found=1;
}
}
if(found==0)
{
printf("The key %d is not found is the array",key);
}
getch();
}

Hope this Program is useful to you in some sense or other. Keep on following this blog for more Mumbai University MCA College Programs. Happy Programming and Studying.

### C Program Factorial with Recursion.

This program is for Factorial using recursive function. This program is part of Mumbai University MCA Colleges C Programs MCA Sem 1

#include<stdio.h>
#include<conio.h>
int sum=1;
int fact(int x)
{
if(x==0)
return sum;
sum=x*fact(x-1);
}

void main()
{
int n;
clrscr();
printf("Enter the value of n\n");
scanf("%d",&n);
printf("\nFactorial of the number is : %d",fact(n));
getch();
}

Hope this Program is useful to you in some sense or other. Keep on following this blog for more Mumbai University MCA College Programs. Happy Programming and Studying.

### C Program Maximum of n numbers

This is a simple program to find the maximum of n numbers . This is a part of Mumbai University MCA Colleges  C Programs MCA Sem 1

#include<stdio.h>
#include<conio.h>
void main()
{
int max,n,num,i;
clrscr();
printf("How many numbers you want to input?\n");
scanf("%d",&n);
printf("Enter the number  ");
scanf("%d",&num);
max=num;
for(i=0;i<(n-1);i++)
{
printf("Enter the number  ");
scanf("%d",&num);
max=(max<num)?num:max;
}
printf("\nThe maximum number is %d",max);
getch();
}

Hope this Program is useful to you in some sense or other. Keep on following this blog for more Mumbai University MCA College Programs. Happy Programming and Studying.

### C Program Matrix Multiplication 2D array

This program is for matrix multiplication using 2 D matrix. This is a part of Mumbai University MCA Colleges C programs MCA Sem 1
#include<stdio.h>
#include<conio.h>
#define size 5
void main()
{
int c[size][size],a[size][size],b[size][size],i,j,sum=0,k,m1,n1,m2,n2;
clrscr();
printf("Enter the order of 1st matrix \n");
printf("Rows \t");
scanf("%d",&m1);
printf("\n Column\t");
scanf("%d",&n1);
printf("Enter the order of 2st matrix \n");
printf("Rows\t");
scanf("%d",&m2);
printf("\n Column\t");
scanf("%d",&n2);
if(n1!=m2)
{
printf("\nMatrix multiplication is invalid");
}
else
{
printf("\nEnter the elements of 1st array");
for(i=0;i<m1;i++)
{
for(j=0;j<n1;j++)
{
scanf("%d",&a[i][j]);
}
}
for(i=0;i<m1;i++)
{
for(j=0;j<n1;j++)
{
printf("%d\t",a[i][j]);
}
printf("\n");
}
printf("\nEnter the elements of 2nd array");
for(i=0;i<m2;i++)
{
for(j=0;j<n2;j++)
{
scanf("%d",&b[i][j]);
}
}
for(i=0;i<m2;i++)
{
for(j=0;j<n2;j++)
{
printf("%d\t",b[i][j]);
}
printf("\n");
}

printf("Multiplication is \n");
for(i=0;i<m1;i++)
{
for(j=0;j<n2;j++)
{
for(k=0;k<n1;k++)
{
sum=sum+a[i][k]*b[k][j];
}
c[i][j]=sum;
sum=0;
}
}
for(i=0;i<m1;i++)
{
for(j=0;j<n2;j++)
{
printf("%d\t",c[i][j]);
}
printf("\n");
}
}
getch();
}

Hope this Program is useful to you in some sense or other. Keep on following this blog for more Mumbai University MCA College Programs. Happy Programming and Studying.

### C program equation roots

This program is for finding the roots (ie. Real and Imaginary part) of a equation. This is a part of Mumbai University MCA Colleges  C Programs MCA Sem 1

#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
float a,b,c;
float r1,r2,num,real,img;
clrscr();
printf("Enter the values of a,b & c\n");
scanf("%f %f %f",&a,&b,&c);
num=((b*b)-(4*a*c));
if(a==0)
{
printf("Its not a quadratic equation");
}
else
{
if(num<0)
{
real=-b/(2*a);
img=(sqrt(-num)/(2*a));
printf("The roots are %f + %fi\n",real,img);
printf("The roots are %f - %fi",real,img);
}
else
{
r1=(-b+(sqrt(num)))/(2*a);
r2=(-b-(sqrt(num)))/(2*a);
printf("The roots are %f and %f",r1,r2);
}
}
getch();
}

Hope this Program is useful to you in some sense or other. Keep on following this blog for more Mumbai University MCA College Programs. Happy Programming and Studying.

### C Program Exponential e raise to x

This Program finds the Exponential using a simple C Program. This is a part of Mumbai University MCA Colleges C Program Sem 1

#include<stdio.h>
#include<conio.h>
#include<math.h>
double fact(double);
double po(double s)
{
double p=1.0,i,sum=1.0,val,f1;
for(i=1;i<=50;i++)
{
p=s*p;
f1=fact(i);
sum=(p/f1)+sum;
}
return(sum);
}

double fact(double n)
{
double ans=1.0,i;
if (n==0.0)
{
return(1);
}
for(i=1;i<=n;i++)
{
ans=ans*i;
}
return(ans);
}

void main()
{
double x;
clrscr();
printf("Enter the value of x \t");
scanf("%lf",&x);
printf("\nThe Value of power of e to x is %lf",po(x));
getch();
}

Hope this Program is useful to you in some sense or other. Keep on following this blog for more Mumbai University MCA College Programs. Happy Programming and Studying.

### C program Decimal to Binary conversion

This Programs does decimal to binary conversion. This is a part of Mumbai University MCA Colleges C programs  Sem 1

#include
#include
void main()
{
int num,r,n,ar,count=0,i=0;
clrscr();
printf("Enter the number to convert");
scanf("%d",&num);
while(num!=0)
{
ar[i]=num%2;
num=num/2;
i++;
count++;
}

printf("The Binary form of this number is ");
for(i=(count-1);i>=0;i--)
{
printf("%d",ar[i]);
}
getch();
}

Hope this Program is useful to you in some sense or other. Keep on following this blog for more Mumbai University MCA College Programs. Happy Programming and Studying.