More Questions • 1) Write a C program to read a matrix A of size nXn and two arrays X and Y.
Download ReportTranscript More Questions • 1) Write a C program to read a matrix A of size nXn and two arrays X and Y.
•
More Questions
1) Write a C program to read a matrix A of size nXn and two arrays X and Y of size n and calculate XA-Y?
• • • • • • • • • • • • • • • • • •
More Questions
{ #include
• • • • • • • • • • • • • • • • • • •
More Questions
printf("given matrix\n"); { for(i=0;i
• • • • • • • • • • • • • • • • • • • • •
} {
More Questions
//calculating X*A { for(i=0;i<1;i++) { for(j=0;j
• • • • • • • • • • • • • •
}
More Questions
printf(“\nresultant matrix “); { for(i=0;i<1;i++) for(j=0;j
•
More Questions
2) Write a function that receives a sorted array of integers and an integer value and insert the integer value in its correct place in the sorted array
• • • • • • • • • • • • • • • • • •
More Questions
{ #include
• • • • • • • • • • • • • • • • • • • • • • • •
}
More Questions
//sorting for(i=0;i
• • • • • • • • • • • • •
{
More Questions
void array(int a[10],int n,int no) int i,pos=0; //finding the position to insert { for(i=0;i
• • • • • • • • • • • •
}
More Questions
} { //inserting for(i=n;i>pos;i--) a[i]=a[i-1]; } a[pos]=no; { printf("\nnew inserted array "); for(i=0;i<=n;i++) printf("%d ",a[i]);
• •
More Questions
3) Write a C program to read an array of size n and calculate its standard deviation given by √∑(xi-x) 2 /n
• • • • • • • • • • • • • • • • • • • • • • • • • • • •
}
More Questions
#include
• •
More Questions
4) Write a C program to read a data stored in a file. Find the value of ∑(xi 2 /n) –∑(xi/n) 2 and write it in another file
• • • • • • • • • • • • • • • • • • • •
More Questions
{ #include
• • • • • • • • • • • • • • • • • • • •
}
More Questions
fp=fopen("num.txt","r"); { for(i=0;i
Find biggest word in the given sentences
• • • • • • • • • • •
Find biggest word in the given sentences
#include
• • • • • • • • • • • • • • • • • • • •
Find biggest word in the given sentences
for(i=0;s[i]!='\0';i++) { if(s[i]==' ') { 2 temp[ss]='\0'; //printf(" %s %d\n",temp,ss); if(ss>big) { big=ss; strcpy(bigstr,temp); } ss=0; } else { temp[ss]=s[i]; ss++; //printf("%c",s[i]); } } 18
• • • • • • • • • • •
Find biggest word in the given sentences
temp[ss]='\0'; 3 } { //printf("%s %d",temp,ss); if(ss>big) big=ss; strcpy(bigstr,temp); } printf("\n Big string %s",bigstr); printf("\n Biggest string length %d",big); getch(); 19
Search the given sub string pattern in the main string
• • • • • • • • • • • • • • • • • • • • • • • •
More Questions
#include
• • • • • • • • • • • • • • •
} {
More Questions
for(i=0;i