Nakum Anil

PRACTICAL-SET—1

1_1.c
W.A.P to print Hello friend's how Are you.

#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\t\t\tHello friends\n\n\t\t\tNakum Anil\n\n\t\t\tE no. 130590107023\n\n\t\t\tBarnch :- C.E.\n\n\t\t\tG.K.Bharad inst. of ing. Rajkot");
getch();
}



1_2.c
Write a program that reads two nos. from key board and gives their addition, subtraction, multiplication, division  and modulo.

#include<stdio.h>
#include<conio.h>
void main()
{
int A,B,E,F,G,H,I;
clrscr();
printf("value of A =");
scanf("%d",&A);
printf("value of B =");
scanf("%d",&B);
E=A+B;
printf("\n Addition of value is E=%d",E);
F=A-B;
printf("\n\n Subtraction of value is F=%d",F);
G=A*B;
printf("\n\n Multiplication of value is G=%d",G);
H=A/B;
printf("\n\n Division of value is H=%d",H);
getch();
}



 1_3.c
 Write a program to convert days into months and days.


#include<stdio.h>
#include<conio.h>
void main()
{
int D,M,Day;
clrscr();
printf("Enter days D=");
scanf("%d",&D);
M=D/30;
printf("\nmonth=%d",M);
Day=D%30;
printf("\n\nDays=%d",Day);
getch();
}



1_4.c
Write a program to solve Quadratic Equation.


#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
float a,b,c,D,E,C,G;
clrscr();
    printf("Enter the value of a=");
    scanf("%f",&a);
    printf("Enter the value of b=");
    scanf("%f",&b);
    printf("Enter the value of c=");
    scanf("%f",&c);
D=(pow(b,2))-4*a*c;
    printf("D=%f",D);
if(D==0)
  {
   E=(-b+sqrt(D))/2*a;
    printf("Ans.=%f",E);
   }
   else if(D>0)
   {
   C=(-b-sqrt(D))/2*a;
    printf("Ans.=%f",C);
   G=(-b+sqrt(D))/2*a;
    printf("Ans.=%f",G);
   }
else
  {
    printf("\nThe value is complx num.");
  }
getch();
}



1_5.c
Write a program to select & print the largest of the three nos. using Nested-If-Else statement.


#include<stdio.h>
#include<conio.h>
void main()
{
int A,B,C;
clrscr();
    printf("Enter the value of A=");
    scanf("%d",&A);
    printf("\nEnter the value of B=");
    scanf("%d",&B);
    printf("\nEnter the value oc C=");
    scanf("%d",&C);
if(A>B)
  {
  if(A>C)
    {
    printf("\nA is Maxsimum=%d",A);
    }
  else
    {
    printf("\nC is Maxsimum=%d",C);
    }
  }
else
  {
  if(B>C)
    {
    printf("\nB is Maxsimum=%d",B);
    }
  else
    {
    printf("\nC is Maxsimum=%d",C);
    }
  }
getch();
}

No comments:

Post a Comment