CODINGS (9-15) IN ONE FILE WITH CORRECT FORMAT

by 18:24 0 comments


CODING:
      
#include<stdio.h>
#include<conio.h>
void main()
{
 int a;
 char b;
 float c;
 double d;
 short int e;
 long int f;
 short char g;
 unsigned int h;
 unsigned char i;
 clrscr();
 printf("\n \t size of the integer variable is %d",sizeof(a));
 printf("\n \t size
of the character variable is %c",sizeof(b));
 printf("\n \t size
of the float variable is %f",sizeof(c));
 printf("\n \t size
of the double variable is %f",sizeof(d));
 printf("\n \t size o
f the short int variable is %d",sizeof(e));
 printf("\n \t size o
f the long int variable is %ld",sizeof(f));
 printf("\n \t size o
f the short char variable is %c",sizeof(g));
 printf("\n \t size o
f the unsigned integer variable is %d",sizeof(h));
 printf("\n \t size o
f the unsigned char variable is %c",sizeof(i));
 getch();
}



CODING:                                                        
                                            
#include<stdio.h>
#include<conio.h>
void main()
{
 int x,y;
 clrscr();
 printf("enter the value of x :");
 scanf("%d",&x);
 printf("Enter the value of y :");
 scanf("%d",&y);
 printf("\nx+y=%d",x+y);
 printf("\nx-y=%d",x-y);
 printf("\nx*y=%d",x*y);
 printf("\nx/y=%d",x/y);
 printf("\nx%y=%d",x%y);
 printf("\nx&&y=%d",x&&y);
 printf("\nx||y=%d",x||y);
 printf("\nx!=y=%d",x!=y);
 printf("\nx&y=%d",x&y);
 printf("\n!y=%d",!y);
 printf("\n~y=%d",~y);
 getch();
}










CODING:
                                   
#include<stdio.h>
#include<conio.h>
void main()
{
 int a,i;
 clrscr();
 printf("\n Enter the value of a \n");
 scanf("%d",&a);
 printf("The Number of series is.....");
 for(i=0;i<=a;i++)
 {
  printf("%d\n",i);
 }
 i=1;
 printf("\n The odd series is ....");
 while(i<=a)
 {
  if(i%2!=0)
  printf("%d",i);
  i=i+1;
 }
 i=1;
 printf("\n The Even series is......");
 do
 {
  if(i%2==0)
  printf("%d",i);
  i=i+1;
 }while(i<=a);
getch();
}


CODING:
                                      
#include<stdio.h>
#include<conio.h>
void main()
{
int a;
clrscr();
printf("Enter the number");
scanf("%d",&a);
if(a%2==0)
{
 printf("\n The Number is Even");
}
else
{
 printf("\n The Number is Odd");
}
getch();
}




                                                                    











CODING:                                                           
                                            
#include<stdio.h>
#include<conio.h>
void main()
{
 float r,area,circumference;
 clrscr();
 printf("\n Enter the Radius:");
 scanf("%f",&r);
 area=3.14*r*r;
 circumference=2*3.13*r;
 printf("\n Area of the circle = %f",area);
 printf("\n circumference of the circle =%f",circumference);
 getch();
}



                                                   
                                                                    


















CODING:                                                             
                                            
#include<stdio.h>
#include<conio.h>
void main()
{
 int a,b,c;
 clrscr();
 printf("Enter Any 3 Number");
 scanf("%d %d %d",&a,&b,&c);
 if((a>b)&&(a>c))
 {
  printf("\n %d is the greatest number",a);
 }
 else if(b>c)
 {
  printf("\n %d is the greatest Number",b);
 }
 else
 {
  printf("%d is the greatest number",c);
 }
 getch();
}




                                                        






CODING:                                                               
                                                                                                          
#include<stdio.h>
#include<conio.h>
void main()
{
  clrscr();
  int a[10],i,n,t,j;
  printf("Enter the limit");
  scanf("%d",&n);
  printf("Enter the array values");
  for(i=0;i<n;i++)
  {
   scanf("%d",&a[i]);
  }
  for(i=0;i<n-1;i++)
  {
   for(j=i+1;j<n;j++)
   {
    if(a[i]>a[j])
    {
     t=a[i];
     a[i]=a[j];
     a[j]=t;
    }
   }
  }
  printf("sorted elements are");
  for(i=0;i<n;i++)
  {
   printf("%d",a[i]);
  }
  getch();
}



CODING:                                                            
                                                                                                        
#include<stdio.h>
#include<conio.h>
struct student
{
 int rollno;
 char name[10],grade;
 float percent;
}a;
void main()
{
 clrscr();
 printf("\n Enter the Student information");
 printf("\n Enter Student Roll NO : ");
 scanf("%d",&a.rollno);
 printf("\n Enter the Student Name : ");
 scanf("%s",&a.name);
 printf("\n Enter the percent : ");
 scanf("%f",&a.percent);
 printf("\n Enter the student grade : ");
 scanf("%c",&a.grade);
 printf("\n Roll no :%d",a.rollno);
 printf("\n Name    :%s",a.name);
 printf("\n Percent :%f",a.percent);
 printf("\n Grade   :%c",a.grade);
 printf("\n Size of :%d",sizeof(a));
getch();
}




CODING:                                                  
                                                                                                                 
#include<stdio.h>
#include<conio.h>
struct student
{
 int rollno;
 char name[10],grade;
 float percent;
}a[10];
void main()
{
 int i,n;
 clrscr();
 printf("\n Enter the No.of students");
 scanf("%d",&n);
 for(i=0;i<n;i++)
 {
  printf("Enter students information.....");
  printf("\n Enter Student Roll NO : ");
  scanf("%d",&a[i].rollno);
  printf("\n Enter the Student Name : ");
  scanf("%s",&a[i].name);
  printf("\n Enter the percentage : ");
  scanf("%f",&a[i].percent);
  printf("\n Enter the student grade : ");
  scanf("%c",&a[i].grade);
 }
 for(i=0;i<=n;i++)
 {
  printf("\n Roll no :%d",a[i].rollno);
  printf("\n Name    :%s",a[i].name);
  printf("\n Percent :%f",a[i].percent);
  printf("\n Grade   :%c",a[i].grade);
 }
 getch();
}


CODING:                                                           
                                                                                                           
#include<stdio.h>
#include<conio.h>
union student
{
 int rollno;
 char grade;
 float percent;
 double average;
}b;
void main()
{
 clrscr();
 printf("Enter the Integer value ");
 scanf("%d",&b.rollno);
 printf("Enter the Character value ");
 scanf("%c",&b.grade);
 printf("Enter the Float value ");
 scanf("%f",&b.percent);
 printf("Enter the Double value ");
 scanf("%f",&b.average);
 printf("size of union =%d",sizeof(b));
 getch();
}




                                             





CODING:                                                    
                                            
#include<stdio.h>
#include<conio.h>
void main()
{
    int a[10][10],i,j,k,b[10][10],c[10][10],r1,c1,r2,c2;
    printf("Enter number of rows and columns of first matrix \n");
    scanf("%d %d",&r1,&c1);
    printf("Enter number of rows and columns of second matrix \n");
    scanf("%d %d",&r2,&c2);
    if(r2==c1)
    {
        printf("Enter rows and columns of First matrix \n");
        for(i=0;i<r1;i++)
        {
         for(j=0;j<c1;j++)
         {
      scanf("%d",&a[i][j]);
     }
    }
   
    printf("Enter rows and columns of Second matrix \n");
    for(i=0;i<r2;i++)
    {
     for(j=0;j<c2;j++)
     {
      scanf("%d",&b[i][j]);
     }
    }
   
    printf("Multiplication of the Matrices:\n");
    for(i=0;i<r1;i++)
    {
     for(j=0;j<c2;j++)
     {
          c[i][j]=0;
          for(k=0;k<r1;k++)
          c[i][j]+=a[i][k]*b[k][j];
      printf("%d\t",c[i][j]);
     }
     printf("\n");
       }
    }
    else
    printf("Matrix multiplication cannot be done");
getch();
}

Jaffar Ahamed

Developer

Cras justo odio, dapibus ac facilisis in, egestas eget quam. Curabitur blandit tempus porttitor. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.

0 comments:

Post a Comment