Professional Documents
Culture Documents
PRACTICAL CODES
PRACTICAL CODES
#include<stdio.h>
int main()
{
float a,b,c;
return 0;
}
// FIBONACCI SERIES
#include<stdio.h>
int main()
{
int n1=0, n2=1, n3, i, no;
return 0;
}
// PASCAL'S TRIANGLE USING NESTED FOR LOOPS (M-1)
#include<stdio.h>
int main()
{
int i, j, sp, row, c=1; /*i =
no. of rows
j =
maximum elements in a row
sp=
spacing
c =
value of element printed in triangle*/
printf("Enter the number of rows for Pascal's
Triangle: ");
scanf("%d",&row);
while(n>0)
{
rem = n%10;
sum = sum + rem*rem*rem;
n = n/10;
}
if(sum == d )
{
printf("%d is an Armstrong number!",d);
}
else
{
printf("%d is not an Armstrong number!",d);
}
}
int main()
{
int num;
printf("Enter the number: ");
scanf("%d",&num);
arm(num);
return 0;
}
transpose(A,B,r,c);
//Calling Tranpose Function
printf("Transpose of Matrix:\n");
for(i=0;i<c;i++)
//Printing the Transpose
{
for(j=0;j<r;j++)
{
printf("%d ",B[i][j]);
//Space between two columns
}
printf("\n");
}
return 0;
}
// STRING OPERATIONS
#include<stdio.h>
#include<string.h>
int main()
{
char str1[50],str2[50];
strcat(str1," ");
strcat(str1,str2);
printf("\nAfter strcat: %s",str1);
// str1= HELLO WORLD str2=WORLD
printf("\nAfter strlwr: %s ",strlwr(str1));
// str1=hello world str2=world
return 0;
}
// STRING PALINDROME
#include<stdio.h>
#include<string.h>
int main()
{
char str1[10];
int l, i, count;
l= strlen(str1);
for(i=0;i<10;i++)
{
scanf("%d",&ptr[i]); // if
*ptr=a then &ptr=a (* anf & both represent address)
}
return 0;
}