Jan

28

#include<stdio.h>

#include<conio.h>

void main(){

int num[50],n,i,key;

printf(“Values want to enter: “);

scanf(“%d”,&n);

for(i=0;i<n;i++){

scanf(“%d”,&num[i]);

}

printf(“\nEnter value want to search: “);

scanf(“%d”,&key);

for(i=0;i<n;i++){

if(num[i]==key){

printf(“\nValue %d is at position %d”,key,++i);

break;

}

}

}

//——————————————————————————————————–

#include<stdio.h>

#include<conio.h>

void main(){

int num[50],n,i,key;

printf(“Values want to enter: “);

scanf(“%d”,&n);

for(i=0;i<n;i++){

scanf(“%d”,&num[i]);

}

printf(“\nEnter value want to search: “);

scanf(“%d”,&key);

for(i=0;i<n;i++){

if(num[i]==key){

printf(“\nValue %d is at position %d”,key,i+1);

}

 

}

}

//——————————————————————————————————–

#include<stdio.h>

#include<conio.h>

void main(){

int num[50],n,i,key,flg=0;

printf(“Values want to enter: “);

scanf(“%d”,&n);

for(i=0;i<n;i++){

scanf(“%d”,&num[i]);

}

printf(“\nEnter value want to search: “);

scanf(“%d”,&key);

for(i=0;i<n;i++){

 

if(num[i]==key){

printf(“\nValue %d is at position %d”,key,i+1);

flg=1;

}

}

if(flg==0)

printf(“\nThis number doesnot exist”);

}

//——————————————————————————————————-

#include<stdio.h>

#include<conio.h>

void main(){

int num[50],n,i,key,flg=0;

printf(“Values want to enter: “);

scanf(“%d”,&n);

for(i=0;i<n;i++){

scanf(“%d”,&num[i]);

}

printf(“\nEnter value want to search: “);

scanf(“%d”,&key);

for(i=0;i<n;i++){

 

if(num[i]==key){

printf(“\nValue %d is at position %d”,key,i+1);

flg=1;

}

}

if(flg==0)

printf(“\nThis number doesnot exist”);

}

//—————————————————————————————————-

#include<stdio.h>

#include<conio.h>

void main(){

int num[3][3],i,j;

printf(“Enter Values in 3 x 3 array: “);

for(i=0;i<3;i++){

for(j=0;j<3;j++){

scanf(“%d”,&num[i][j]);

}

}

printf(“\nValues in 3×3 array are:\n”);

for(i=0;i<3;i++){

for(j=0;j<3;j++){

printf(“%6d”,num[i][j]);

}

printf(“\n”);

}

//————–TRANSPOSE

printf(“\nMatrix transpose —\n”);

for(i=0;i<3;i++){

for(j=0;j<3;j++){

printf(“%6d”,num[j][i]);

}

printf(“\n”);

}

}


Leave a Reply