Posts
Showing posts from May, 2021
write a program to find sum of two numbers by using function with no argument no return value. write a program of the following operations. a)input 2 number from the user. Add and display the result b)repeat step(a) c)print your name d)product e)product
- Get link
- X
- Other Apps
write a program to find the sum of two numbers 3 times using no argument and no return value.
- Get link
- X
- Other Apps
write a program to find the number of days in a matrix.
- Get link
- X
- Other Apps
write a program to find roots of a quadratic equation .
- Get link
- X
- Other Apps
write a program to print "hello world" in c language.
- Get link
- X
- Other Apps
write a program for insertion sort with example.
- Get link
- X
- Other Apps
#include<stdio.h> #include<conio.h> int main() { int a[50],n,i,j,temp; printf("enter the size of an array\n"); scanf("%d",&n); printf("enter the elements in an array\n"); for(i=0;i<n;i++) { scanf("%d",&a[i]); } for(i=1;i<n;i++) { temp=a[i]; j=i-1; while(j>=0 &&a[j]>temp) { a[j+1]=a[j]; j=j-1; } a[j+1]=temp; } for(i=0;i<n;i++) { printf("%d\t",a[i]); } return 0; }
write a program to find the elements of an array by using binary search .
- Get link
- X
- Other Apps
#include<stdio.h> #include<conio.h> int main() { int a[50],first=0,middle=0,last,search,n,i; printf("enter the size of an array\n"); scanf("%d",&n); printf("enter integer in ascending order\n",n); for(i=0;i<n;i++) { scanf("%d",&a[i]); } printf("enter value to search\n"); scanf("%d",&search); last=n-1; while(first<=last) { middle=(first+last)/2; if(a[middle]<search) { first=middle+1; } else if(a[middle]==search) { printf("%d found at location %d\n",search,middle+1); break; } else { last=middle-1; } } if(first>last) { printf("%d not found\n",search); } return 0; }
write a program to check the repetition of a number and find its position .
- Get link
- X
- Other Apps
#include<stdio.h> #include<conio.h> int main() { int a[100],i,n,val,c=0; printf("enter the size of an array\n"); scanf("%d",&n); printf("enter the element in aaray\n"); for(i=0;i<n;i++) { scanf("%d",&a[i]); } printf("enter the value for search\n"); scanf("%d",&val); for(i=0;i<n;i++) { if(val==a[i]) { c++; printf("value lies at position n%d\n",i++); } } if(c==0) printf("value does not found\n"); else printf("value lies %d times",c); return 0; }
write a program to search or find the element in array by using linear search .
- Get link
- X
- Other Apps
write a program to copy string with using string function .
- Get link
- X
- Other Apps
write a program to read the elements in two dimensional array and add 9 to each elements of array and print it.
- Get link
- X
- Other Apps
#include<stdio.h> #include<conio.h> int main() { int a[4][4],n,m,i,j; printf("Enter the no of row and column\n"); scanf("%d%d",&n,&m); for(i=0;i<n;i++) { for(j=0;j<m;j++) { scanf("%d",&a[i][j]); } } printf("Result after adding 9 with each element of given array\n"); for(i=0;i<n;i++) { for(j=0;j<m;j++) { printf("%d\t",a[i][j]+9); } printf("\n"); } getch (); }
write a program to find sum of two matrices.
- Get link
- X
- Other Apps
#include<stdio.h> #include<conio.h> int main() { int a[2][2],b[2][2],c[2][2],i,j; printf("enter the value of first matrix\n"); for(i=0;i<2;i++) { for(j=0;j<2;j++) { scanf("%d",&a[i][j]); } } printf("enter the value of second matrix\n"); for(i=0;i<2;i++) { for(j=0;j<2;j++) { scanf("%d",&b[i][j]); } } printf("value of first matrix\n"); for(i=0;i<2;i++) { for(j=0;j<2;j++) { printf("%d\t",a[i][j]); } printf("\n"); } printf("value of second matrix\n"); for(i=0;i<2;i++) { for(j=0;j<2;j++) { printf("%d\t",b[i][j]); } printf("\n"); } for(i=0;i<2;i++) { for(j=0;j<2;j++) { c[i][j]=a[i][j]+b[i][j]; } } printf("addition of two matrix\n"); for(i=0;i<2;i++) { for(j=0;j<2;j++) { printf("%d\t",c[i][j]); } printf("\n"); } return 0; } ...
write a program to find the sum of two arrays.
- Get link
- X
- Other Apps
#include<stdio.h> #include<conio.h> int main() { int a1[5],a2[5],a3[5],i; printf("enter five value in first array\n"); for(i=0;i<5;i++) { scanf("%d",&a1[i]); } printf("enter five value in second array\n"); for(i=0;i<5;i++) { scanf("%d",&a2[i]); } for(i=0;i<5;i++) { a3[i]=a1[i]+a2[i]; } printf("addition of two array\n"); for(i=0;i<5;i++) { printf("%d\n",a3[i]); } return 0; }
write a program to find the greatest number among 10 numbers in 1-d array.
- Get link
- X
- Other Apps