Tuesday, 28 February 2012

Record Questions in C language



Start writing the records whatever we finished the program and submit in time.
                                          Records questions:

You should write the following format:
(i) definition (ii)syntax (iii)example program with comments (iv)Advantages (v)Disadvantages (vi) Rules
Computer Fundamentals

1.        Write internal and external commands
2.      Batch files
3.      Window’s
4.      Procedure for installing software
5.      Procedure for uninstalling  software
6.      Procedure for installing hardware
7.      Procedure for uninstalling hard ware
8.      Changing system date and time
9.      Desktop properties’
10.   Installing modem
C Language:

1.     How to write , compile, execute the c program
4.   Wap to convert Fahrenheit to celicius
5.   Write a c program to use all the arithmetic operations.
6.   Wap to find out the largest of 2 no’s using conditional operators
7.   Write a java program to demonstrate type casting
8.   Wap to find out even numbers using Simple If statement
91.  Wap to find year is leap year or not using logical operators and if..else statement
10.  Wap to calculate the division obtained by a student using ‘if..else Lader’
12.  Wap to calculate the first ‘n’ natural numbers using ‘for loop
13.  Wap to find factorial of a number using ‘while loop
14. wap to find sum of n natural numbers using ‘do..while ‘ loop
15.  Wap to find prime or not?
17.  Wap to find given no is palindrome or not
#include<stdio.h>
#include<conio.h>
void main()
{
 int a[2][3],b[3][2],c[2][3];
 int i,j;
 clrscr();
 printf("enter values into a \n");
 for(i=0;i<=2-1;i++)
 {
  for(j=0;j<=3-1;j++)
  {
   scanf("%d",&a[i][j]);
  }
 }
 printf("enter values into b\n");
 for(i=0;i<=2-1;i++)
 {
  for(j=0;j<=3-1;j++)
  {
   scanf("%d",&b[i][j]);
  }
 }
 printf("addition of two marices is\n");
 for(i=0;i<=2-1;i++)
 {
  for(j=0;j<=3-1;j++)
  {
   c[i][j]=a[i][j]+b[i][j];
   printf("%d\t",c[i][j]);
  }
  printf("\n");
 }
 getch();
}

19.   Wap to illustrate call by value and call by reference
20.   Write a c program to demonstrate 1d(one demenstional) array
21.   Wap to find sum of two arrays
22.   Wap to print reverse of an array
23.   Wap to find the matrix multiplication

#include<stdio.h>
#include<conio.h>
void main()
{
 int a[3][3];
 int b[3][2];
 int c[5][5];
 int i,j,k,m,n,p,q;
 clrscr();
 printf("enter the size of the first matrix (m,n)\n");
 scanf("%d%d",&m,&n);
 printf("enter the size of the 2nd matrix (p,q)\n");
 scanf("%d%d",&p,&q);

 printf("enter the elements into 1array\n");
 for(i=0;i<=m-1;i++)
  {
   for(j=0;j<=n-1;j++)
   {
    scanf("%d",&a[i][j]);
   }
  }
  printf("enter the elements into 2array\n");
 for(i=0;i<=p-1;i++)
  {
   for(j=0;j<=q-1;j++)
   {
    scanf("%d",&b[i][j]);
   }
  }


 if(n==p)//1st matrix colm must be equal to 2nd matrix row size
 {
  //processing the product of two matrix
  for(i=0;i<=m-1;i++)
  {
   printf("\n");
   for(j=0;j<=q-1;j++)
   {
    c[i][j]=0;//initializing matrix c with zeros
    for(k=0;k<=n-1;k++)
    {
     c[i][j]=c[i][j]+a[i][k]*b[k][j];
    }
    printf("%d\t",c[i][j]);
   }
   printf("\t");
  }//outer loop
 }//if
else
 printf("matrix can not be multiplied");
 getch();
}
24.  Wap to transpose of given matrix

#include<stdio.h>
#include<conio.h>
void main()
{
 int a[5][5];
 int i,j,m,n,temp;
 m=3;n=3;
 clrscr();

 printf("enter the size of the first matrix (m,n)\n");
 scanf("%d%d",&m,&n);

 printf("enter the elements into 1array\n");
 for(i=0;i<=m-1;i++)
  {
   for(j=0;j<=n-1;j++)
   {
    scanf("%d",&a[i][j]);
   }
  }

 //transpose logic
 for(i=0;i<=m-1;i++)
 {
  for(j=0;j<=n-1;j++)
  {
   if(i<j)//swapping values above diagnols with those below diagnols
   {
    temp=a[i][j];
    a[i][j]=a[j][i];
    a[j][i]=temp;
   } //end of if
  }//end of inner loop
 } //end of outer
 //displaying the tranpose matrix
 for(i=0;i<=m-1;i++)
 {
  for(j=0;j<=n-1;j++)
  {
   printf("%d\t",a[i][j]);
  }//inner loop
  printf("\n");
 }//outer loop
 getch();
}
/*
        1 2 3
        4 5 6
o/p:
*/
25.   Wap of factorial using recursion function
26.   Wap to display the following format
*
**
***




No comments:

Post a Comment