Computer Programming: Assignment: 2
Computer Programming: Assignment: 2
Computer Programming: Assignment: 2
ASSIGNMENT: 2
IIT(ISM) DHANBAD
CODE:
#include <stdio.h>
int main()
{
int size1 ,size2 ,index=size1+size2-1 , arr1[size1] ,arr2[size2]
,arr[index+1] ;
scanf("%d%d",&size1,&size2);
printf("Enter array1 elements:");
for(int i=0;i<size1;i++)
{
scanf("%d",&arr1[i]);
arr[index--]=arr1[i];
}
printf("Enter array2 elements:");
for(int i=0;i<size2;i++)
{
scanf("%d",&arr2[i]);
arr[index--]=arr2[i];
}
printf("First array is ");
for(int i=0;i<size1;i++)
printf("%d ",arr1[i]);
printf("\nSecond array is ");
for(int i=0;i<size2;i++)
printf("%d ",arr2[i]);
printf("\nArray in reverse order is ");
for(int i=0;i<size2+size1;i++)
printf("%d ",arr[i]);
printf("\n");
}
CODE:
#include <stdio.h>
#include <ctype.h>
int main()
{
char s1[1000];
char s2[1000];
printf("The first string is ");
scanf("%s",s1);
printf("The second string is ");
scanf("%s",s2);
int l=0,l1=0;
for(int i=0;s2[i]!='\0';i++)
l++;
for(int i=0;s1[i]!='\0';i++)
l1++;
printf("n=");
int n;
scanf("%d",&n);
for(int i=0;i<n;i++)
s2[l+i]=toupper(s1[l1-n+i]);
printf("After concatenation of last %d elements of first string
with second string with uppercase conversion is ",n);
for(int i=0;i<(l+n);i++)
printf("%c",s2[i]);
printf("\n");
}