Write a c program to print Floyd’s triangle

1. Write a c program to print Floyd’s triangle

2. C program to display Floyd’s triangle
3. How to print Floyd’s triangle in c



#include<stdio.h>


int main(){
  int i,j,r,k=1;
  printf("Enter the range: ");
  scanf("%d",&r);
  printf("FLOYD'S TRIANGLE\n\n");
  for(i=1;i<=r;i++){
      for(j=1;j<=i;j++,k++)
           printf(" %d",k);
      printf("\n");
  }
  return 0;
}

C code for factorial of a number

Code 1:
1. C code for factorial of a number
2. C program to find the factorial of a given number
3. Factorial program in c using while loop
4. Factorial program in c without using recursion
#include<stdio.h>
int main(){
  int i=1,f=1,num;
  printf("Enter a number: ");
  scanf("%d",&num);
  while(i<=num){
      f=f*i;
      i++;
  }
  printf("Factorial of %d is: %d",num,f);
  return 0;
}
Sample output:
Enter a number: 5
Factorial of 5 is: 120

WRITE A C PROGRAM to concatinate of two string

#include <stdio.h>
#include <string.h>

int main()
{
    char a[100], b[100];
   
    printf("Enter the first string\n");
    gets(a);
   
    printf("Enter the second string\n");
    gets(b);
   
    strcat(a,b);
   
    printf("String obtained on concatenation is %s\n",a);
   
    return 0;

}

program for addition of two matrices using arrays

 



 #include<stdio.h>
int main(){
  int a[3][3],b[3][3],c[3][3],i,j;
  printf("Enter the First matrix->");
  for(i=0;i<3;i++)
      for(j=0;j<3;j++)
           scanf("%d",&a[i][j]);
  printf("\nEnter the Second matrix->");
  for(i=0;i<3;i++)
      for(j=0;j<3;j++)
           scanf("%d",&b[i][j]);