Menus

Showing posts with label C TUTORIALS. Show all posts
Showing posts with label C TUTORIALS. Show all posts

Wednesday, 23 February 2022

Printing Pattern in C | Inverted Half Pyramid

 


#include<stdio.h>

void main()

{

int i,j,r=6;

clrscr();


  for(i=1;i<=r;i++)

  {

   for(j=r;j>=i;j--)

   {

     printf("*");

   }

   printf("\n");

  }


getch();

}





Saturday, 17 April 2021

Printing Pattern in C


Output



Source Code

 

#include<stdio.h>

void main()

{

int i,j,k,rows=7;

clrscr();

  for(i=1;i<=rows;i++)

  {

   //print blank space

   for(j=1;j<=rows;j++)

   {

     if((i+j)<=rows)

       printf(" ");

     else

       printf("*");

   }

   printf("\n");

  }

  getch();

}


Video




Monday, 9 December 2019

Write a C program for to find largest among three numbers


#include<stdio.h>

void main()
{

int x,y,z;

printf("Enter three numbers : ");
scanf("%d,%d,%d",&x,&y,&z);

if((x>y) && (x>z))
{
printf("The greater value is %d\n",x);
}
else if(y>z)
{
printf("The greater value is %d\n",y);
}
else
{
printf("The greater value is %d\n",z);
}

}







Monday, 2 December 2019

Write a C program for Arithmetic Operations



Arithmetic Operators: These are used to perform arithmetic/mathematical operations on operands. 


  • Addition: The ‘+’ operator adds two operands. For example, x+y.
  • Subtraction: The ‘-‘ operator subtracts two operands. For example, x-y.
  • Multiplication: The ‘*’ operator multiplies two operands. For example, x*y.
  • Division: The ‘/’ operator divides the first operand by the second. For example, x/y.
  • Modulus: The ‘%’ operator returns the remainder when first operand is divided by the second. For example, x%y.


Program

#include<stdio.h>

void main()
{

int a,b,c,d,f,g,h;


printf("Enter first number ");
scanf("%d",&a);
printf("Enter Second number ");
scanf("%d",&b);

c=a+b;
printf("Sum %d ",c);

d=a-b;
printf("\nDifference %d ",d);

f=a*b;
printf("\nProduct %d ",f);

g=a/b;
printf("\nDiv %d ",g);

h=a%b;
printf("\nMod %d \n",h);



}







Sunday, 1 December 2019

Write C program to print "Hello World"



ALGORITHM

1. BEGIN
2. PRINT "Hello World"
3. END

PROGRAM 


#include<stdio.h>
void main()
{
 printf("Hello World\n");

}


Print Hello World - Malayalam




Introduction to GCC and example