Showing posts with label c. Show all posts
Showing posts with label c. Show all posts

Tuesday, 27 December 2016

C PROGRAMMING PROJECT 5

FINDING LARGEST NUMBER IN ARRAYS


#include<stdio.h>
#include<conio.h>

void main()
{
int a[4],temp,i;
printf("enter the values");
for (i=0;i<4;i++)

{
scanf("%d",&a[i]);
}
temp=a[0];
for (i=0;i<4;i++)
{
if(temp<a[i])
{
temp=a[i];
}
}
printf("largest number is =%d",temp);
getch();
}

C Language project 4

              PALINDROME WITH  INBUILT FUNCTION    



#include<stdio.h>
#include<conio.h>
#include<string.h>

void main()
{
    char s1[20],s2[20];
    int i=0;
    printf("\n enter the string");
    scanf("%s",&s1);
    strcpy(s2,s1);
    strrev(s1);
    i=strcmp(s1,s2);
    if(i==0)
    {
        printf("\n string is palindrome");

    }
    else{
        printf("\n string is not palindrome");
    }
}

C PROGRAMMING PROJECT 3

  PALINDROME WITHOUT USE OF INBUILT FUNCTION


#include<stdio.h>
#include<conio.h>
#include<string.h>

void main()
{
    char a[25];
    int i=0,j,c;
    printf("\n enter the string\n");
    gets(a);
    while(a[i]!='\0')
    {
        i++;

    }
    for(j=0;j<i-1;j++)
    {
        if(a[j]==a[(i-1)-j])
            c=0;
        else
            c=1;

    }
    if(c==0)
    {
    printf(" entered string is palindrome");
    }
    if(c==1)
    {
    printf(" entered string is not palindrome");
    }
getch();

}

C LANGUAGE PROJECT 2


        AREA OF DIFFERENT SHAPES WITH STRUCTURE



/*PROGRAM MADE BY ARUN aka ATOM*/
#include<stdio.h>
#include<conio.h>
#include<math.h>
#include<string.h>
struct square
{
int s;
};
struct rightri
{
int base,h;
};
struct circle
{
int r;
};
struct rectangle
{
int l,b;
};
struct parallelogram
{
int ba,hi;
};
void main()
{
struct square s1;
struct rightri rt;
struct circle c;
struct rectangle rec;
struct parallelogram plm;
int a;
char ans[5];
float k;
m:
clrscr();
printf("\n\t\t\tFinding area of different shapes");
printf("\n\n\t1.SQUARE");
printf("\n\t2.RIGHT TRIANGLE");
printf("\n\t3.CIRCLE");
printf("\n\t4.RECTANGLE");
printf("\n\t5.PARALLELOGRAM");
printf("\n\n\tEnter you choice for above :");
scanf("%d",&a);
clrscr();
switch(a)
{
case 1:
printf("\n\n\tEnter side of square: ");
scanf("%d",&s1.s);
k=s1.s*s1.s;
printf("\n\tYour answer is :%f",k);
break;
case 2:
printf("\n\n\tEnter base of triangle: ");
scanf("%d",&rt.base);
printf("\tEnter height of triangle: ");
scanf("%d",&rt.h);
k=(rt.h*rt.base)/2;
printf("\nYour answer is :%f",k);
break;
case 3:
printf("\n\n\tEnter radius of cirlce: ");
scanf("%d",&c.r);
k=3.14*c.r*c.r;
printf("\nYour answer is :%f",k);
break;
case 4:
printf("\n\n\tEnter length of rectangle: ");
scanf("%d",&rec.l);
printf("\tEnter breadth of rectangle: ");
scanf("%d",&rec.b);
k=rec.l*rec.b;
printf("\nYour answer is :%f",k);
break;
case 5:
printf("\n\n\tEnter base of parallelogram: ");
scanf("%d",&plm.ba);
printf("\tEnter height of parallelogram: ");
scanf("%d",&plm.hi);
k=plm.hi*plm.ba;
printf("\nYour answer is:%f",k);
break;
default:
printf("\n\n\n\n\tEnetered choice is invalid");
}
printf("\n\n\n\t\tWANT TO CONTINUE- ");
scanf("%s",&ans);
if(ans[0]=='y' || ans[0]=='Y')
goto m;
else
clrscr();
printf("\n\n\n\n\n\n\n\n\t\t-------------------THANK YOU-----------------");
getch();
}

C language projet 1

Multiplication Of Matrix




#include<stdio.h>
#include<conio.h>

void main()
{
int f[2][2],j,i,m,n,sum=0,s[2][2],t[2][2];
printf("enter the values first matrix\n\n");
for (i=0;i<2;i++)

    {
for (j=0;j<2;j++)
    {
      printf("enter the values f%d%d :",i+1,j+1);
      scanf("%d",&f[i][j]);
    }
    }
printf("\nenter the values second matrix\n\n");

for (m=0;m<2;m++)

    {
for (n=0;n<2;n++)
    {
      printf("enter the values s%d%d :",m+1,n+1);
      scanf("%d",&s[m][n]);
    }
    }
    for (i=0;i<2;i++)
    {
    for (n=0;n<2;n++)
    {
     for(j=0;j<2;j++)
     {

        sum=sum+f[i][j]*s[j][n];
    }
    t[i][n]=sum;
    sum=0;
}
}
printf("\n\n\nprojuct of matrix is\n\n");
for (i=0;i<2;i++)
{
    for (j=0;j<2;j++)
{
printf("%d  ",t[i][j]);
}
printf("\n");
}
return 0;
}