Computer practical -Class 11

Mr.Krishna
By -
0

Computer programming project-Class 11 


#include<stdio.h>

#include<conio.h>

#include<math.h>

int main()

{

 int aa,bb,n,a,b,sum=0, num[100],c,d,temp, diff,N,rev=0,D,Num,R=0, r,C,m1[10][10],m2[10][10],s[10][10],y,z,f,bin,dec=0,re,p=0,abc;

abc:

printf("\n•Please pick a Choice.");

 printf("\n1. What is this program?\n");

 printf("2.Sum of even numbers of input number.\n");

 printf("3.Checking whether the user input number is palindrome or not\n");

 printf("4.Reversing the user input number\n");

 printf("5.Addition of matrix\n");

 printf("6.Convert the input binary number into equivalent decimal digit\n");

 printf("\n");

 printf("Enter your choice:");

 scanf("%d",&n);

 printf("\n");

 switch(n)

 {

  case 2:

printf("Enter the number upto which you want the sum of:");

  scanf("%d",&b);

  for(a=2;a<=b;a++)

 {

  if (a%2==0)

  sum=sum+a;

 }

 printf("%d\n",sum);

printf("\n");

printf("Would You like to Continue?\n[1 for yes and 0 for no]\n\n");

scanf("%d",&aa);

if(aa==1)

{

goto abc;}

else{

printf("Thanks for being interested in the program!");}


 break;

 case 1:

printf("This program was created by Krishna Sapkota.\n This program contains a total of 5 program combined together.Each program will execute correct answers.\n This is a project work created for NEB practical examination");

 printf("\n");

printf("Would You like to Continue?\n[1 for yes and 0 for no]\n\n");

scanf("%d",&aa);

if(aa==1)

{

goto abc;}

else{

printf("Thanks for being interested in the program!");}


case 3:

  printf("Enter the number:");

 scanf("%d",&N);

f=N;

 while(N!=0)

 {

  diff=N%10;

  rev=rev*10+diff;

  N=N/10;

 }

 if(rev==f)

 {

 printf("The number is palindrome");

}

else {


 printf("The number is not palindrome");

}

printf("\n");

printf("Would You like to Continue?\n[1 for yes and 0 for no]\n\n");

scanf("%d",&aa);

if(aa==1)

{

goto abc;}

else{

printf("Thanks for being interested in the program!");}


break;

 case 4:


   printf("Enter the number:");

 scanf("%D",&Num);


 while(Num!=0)

 {

  D=Num%10;

  R=R*10+D;

  Num=Num/10;

 }

 printf("%d is the reverse of input number",R);

R=0;

printf("\n");

printf("Would You like to Continue?\n[1 for yes and 0 for no]\n\n");

scanf("%d",&aa);

if(aa==1)

{

goto abc;}

else{

printf("Thanks for being interested in the program!");}


 break;

 case 5:

   printf("Enter the number of rows and column you want:");

 scanf("%d%d",&y,&z);

 for(r=0;r<y;r++)

 {

  for(C=0;C<z;C++)

  {

   printf("Enter number for element m1[%d][%d]:",r,C);

   scanf("%d",&m1[r][C]);

  }

 }

    printf("Your first matrix is given below\n");

  for(r=0;r<y;r++)

 {

  for(C=0;C<z;C++)

  {


   printf("%d\t",m1[r][C]);

  }

  printf("\n");

 }

  for(r=0;r<y;r++)

 {

  for(C=0;C<z;C++)

  {

   printf("Eter number for element m2[%d][%d]:",r,C);

   scanf("%d",&m2[r][C]);

}

}


 printf("Your second matrix is given below\n");

  for(r=0;r<y;r++)

 {

  for(C=0;C<z;C++)

  {

  

   printf("%d\t",m2[r][C]);

  }

  printf("\n");

 }

for(r=0;r<y;r++)

{

 for(C=0;C<z;C++)

 {

  s[r][C]=m1[r][C]+m2[r][C];

 }

}

printf("The sum of matrices are given below\n");

for(r=0;r<y;r++)

{

 for(C=0;C<z;C++)

 {

  printf("%d\t",s[r][C]);

 }

 printf("\n");

}

break;

printf("\n");

printf("Would You like to Continue?\n[1 for yes and 0 for no]\n\n");

scanf("%d",&aa);

if(aa==1)

{

goto abc;}

else{

printf("Thanks for being interested in the program!");}


case 6:

 printf("Enter binary number to be converted:");

 scanf("%d",&bin);

 while(bin!=0)

 {

  re=bin%10;

  dec=dec+re*pow(2,p);

  bin=bin/10;

  p++;

 }

 printf("%d is equivalent decimal",dec);

printf("\n");

printf("Would You like to Continue?\n[1 for yes and 0 for no]\n\n");

scanf("%d",&aa);

if(aa==1)

{

goto abc;}

else{

printf("Thanks for being interested in the program!");}


}

}

  ................................................................................................

Post a Comment

0Comments

Post a Comment (0)