Friday, August 27, 2021

Program to print largest values

 8.program to print largest value


#include<stdio.h>

#include<conio.h>


void main()

{

  int a,b;

  clrscr();


  printf("Enter 1st number : ");

  scanf("%d",&a);


  printf("Enter 2nd number : ");

  scanf("%d",&b);


  if(a>b)

    printf("Largest value is : %d",a);

  else

    printf("Largest value is : %d",b);


  getch();

}

Swap the values

7. Program to accept values and swap their values.


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

void main()
{
  int a,b,temp;
  clrscr();

  printf("Enter 1st number : ");
  scanf("%d",&a);

  printf("Enter 2nd number : ");
  scanf("%d",&b);

  printf("\nBefore Swapping...");
  printf("A=%d, B=%d",a,b);

  temp=a;
  a=b;
  b=temp;

  printf("\nAfter Swapping...");
  printf("\n A=%d, B=%d",a,b);

  getch();
}

Monday, August 23, 2021

print square and cube

 6.program to accept a number from user and print its square and cube. 

#include<stdio.h>

#include<conio.h>


void main()

{

  int n,sqre,cube;

  clrscr();


  printf("Enter Number: ");

  scanf("%d",&n);


  sqre=n*n;

  cube=n*n*n;


  printf("\nSquare: %d\nCube: %d",sqre,cube);


  getch();

Thursday, August 19, 2021

area of circle

 5.program to accept value of radius and print area of a circle. 

 #include<stdio.h>

#include<conio.h>


void main()

{

  float area,radius;

  clrscr();


  printf("Enter Radius:");

  scanf("%f",&radius);


  area=3.14*radius*radius;


  printf("Area : %f",area);


  getch();

}

Sunday, August 15, 2021

Program to print simple interest

 4.program to print simple interest:-


  #include<stdio.h>

#include<conio.h>

void main()

{

  float interest, p, r, n;

  clrscr();

  printf("Enter value of P: ");

  scanf("%f",&p);

  printf("Enter value of R: ");

  scanf("%f",&r);

  printf("Enter value of N: ");

  scanf("%f",&n);


  interest=p*r*n/100;


  printf("Simple Interest : %f", interest);


  getch();

}

Friday, August 13, 2021

Addition program part2

 3.Program to accept values of two numbers and print their addition 

#include<stdio.h>

#include<conio.h>

void main()

{

  int a,b,ans;

  clrscr();

  printf("Enter 1st number:");

  scanf("%d",&a);

  printf("Enter 2nd number:");

  scanf("%d",&b);

  ans = a + b;

  printf("Addition is : %d",ans);

  getch();

}

Labels:

Addition program - C language

2. Program to assign values of two numbers and print their addition. 

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

void main()
{
  int a=10,b=20;
  clrscr();

  int ans = a + b;

  printf("Addition is : %d",ans);

  getch();



C language programs "Hello world"

 1. Program to print "Hello world"  

#include<stdio.h>

#include<conio.h>

void main() 

{

  clrscr();

  printf("Hello World!!");

  getch();

Learn total c language-https://youtube.com/playlist?list=PL7ersPsTyYt2Q-SqZxTA1D-melSfqBRMW

Labels: