Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  test3
Language: C/C++
Code:
#include<stdio.h>
#include<conio.h>
main()
{
int x[20],i,n,t,r,a=0;
printf("Enter the no. of terms:");
scanf("%d",&n);
printf("Enter the terms one by one..");
for(i=0;i<n;i++)
scanf("%d",&x[i]);
printf("Enter the term to search:");
scanf("%d",&t);
printf("Enter a number to replace with..");
scanf("%d",&r);
for(i=0;i<n;i++)
if(x[i]==t)
{
x[i]=r;
a=1;
}
if(a>0)
{
printf("Number found and replaced..");
printf("the new array is:");
for(i=0;i<n;i++)
printf("%d",x[i]);
}
else
printf("number not found");
getch();
}
          
          
          
          
          
Comments: