Professional Documents
Culture Documents
******OUTPUT******
Final String: M.S.Dhoni
******INPUT******
Enter the number: 987654321
******OUTPUT******
Reverse of the number is : 123456789
***INPUT***
Enter name of the employee: Devashish
***OUTPUT***
Name of the employee is: Devashish
***OUTPUT***
23 29 31 37
20 21 22 24 25 26 27 28 30 32 33 34 35 36 38 39
***INPUT***
Enter the content: Coding is satisfaction
***OUTPUT***
Coding is satisfaction
The positions are: 3 7 13 19
******INPUT******
Enter a number for which the factorial to be calculated: -5
******OUTPUT******
Number is negative. Factorial can't be calculated.
******INPUT******
Enter a number for which the factorial to be calculated: 0
******OUTPUT******
Factorial of zero is 0.
******INPUT******
Enter a number for which the factorial to be calculated: 5
******OUTPUT******
Factorial of 7 is 5040
***INPUT***
***INPUT***
***INPUT***
***INPUT***
first string must be entered: coding
second string must be entered: gingid
***OUTPUT***
7.WAP to add elements of two unequal size array into 3 rd array using
Dynamic Memory Allocation. */
#include <stdio.h>
#include <stdlib.h>
void main()
{
int *p1,*p2,*p3,m,n,i,max;
printf("\t\t\t****INPUT****\n");
printf("Enter the size of first array\n");
scanf("%d",&m);
p1 = (int*)calloc(m,sizeof(int));
printf("Enter the elements in the array\n");
for(i=0;i<m;i++)
scanf("%d",p1+i);
printf("Enter the size of the second array\n");
scanf("%d",&n);
p2 = (int*)calloc(n,sizeof(int));
printf("Enter the elements in the array\n");
for(i=0;i<n;i++)
scanf("%d",p2+i);
max = (n>m)?n:m;
p3 = (int*)calloc(max,sizeof(int));
printf("\t\t\t****OUTPUT****\n");
for(i=0;i<max;i++)
{
*(p3+i) = *(p1+i) + *(p2+i);
printf("%d ",*(p3+i));
}
}
****INPUT****
Enter the size of first array
5
Enter the elements in the array
12345
Enter the size of the second array
6
Enter the elements in the array
123456
****OUTPUT****
2 4 6 8 10 6