import java.util.*;
class Char
{
public static void main(String r[])
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter number of characters: ");
int n=sc.nextInt();
String in[]=new String[n];
for(int i=0;i<n;i++)
{
in[i]=sc.next();
}
for(int i= 0;i<n;i++)
{
if(in[i].equals("dle"))
{
in[i]="dle dle";
}
}
System.out.println("Transmitted message is: ");
System.out.print(" dle stx ");
for(int i=0;i<n;i++)
{
System.out.print(in[i]+" ");
}
System.out.println(" dle etx ");
}
}
Example:
Sample output:
Enter number of characters:
5
a b dle dle d e
Transmitted message is:
dle stxa b dle dle dle dle d dle etx
Welcome guys................... This blog is basically created to accumulate and share as much knowledge i can share. I will try to cover as much of topic I can. So just post any program or concept you want to know related to any programming language, Tibco , Algorithm, OOPS, android etc. You are free to post any problem you may face in these programs just post a comment. If you are not able to make any program just post the details and it will be posted to this blog as soon as possible.
Java FAQ
Thursday, 11 April 2013
Program to concatinate two strings
Program to concatinate two strings in C
void main()
{
char a[]={"Hello"}; //declare first char array
char b[]={"Everyone"}; //declare second char array
char c[50];
int n,i,j,k=0;
clrscr();
n=sizeof(a)+sizeof(b)-2; //store the total size of both array
for(i=0;i<sizeof(a);i++) //storing first array in the resultant array
c[i]=a[i];
for(i=sizeof(a)-1;i<n;i++,k++) //storing the second array in the resultant array
c[i]=b[k];
for(i=0;i<n;i++)
printf("%c",c[i]); //displat the result
getch();
}
Monday, 8 April 2013
New Page added "ASK"
In this page u can ask any question or query or code related to any of the programming language which may be of C,C++,JAVA.
The solution will be posted on the blog as soon as possible...
So don't hesitate and ask anything u want......
visit http://rrprograms.blogspot.in/p/blog-page.html
Subscribe to:
Posts (Atom)