3. Write a c program to delete the all consonants from given string.
9. Write a c program to print the string from given character.
10. Write a c program to reverse a string
11. Reverse a string using recursion in c
12. String concatenation in c without using strcat
13. How to compare two strings in c without using strcmp
14. String copy without using strcpy in c
15. Convert a string to ASCII in c
10. Write a c program to reverse a string
11. Reverse a string using recursion in c
12. String concatenation in c without using strcat
13. How to compare two strings in c without using strcmp
14. String copy without using strcpy in c
15. Convert a string to ASCII in c
68 comments:
write a program if a customer has an account more than 5 years and is a government servant then loan approve , government servant or not an account more than 5 years loan approve , customer account less than 5 years and not a government servant then loan not approve.
I am not a pro, just tried about what you asked, here is the code, may this help you.
#include
#include
#include
void main()
{
int atime;
char gsev[10];
clrscr();
printf("Enter the time you are active about the account:");
scanf("%d",&atime);
printf("Government servant? Enter YES or NO:");
scanf("%s",gsev);
if(atime>=5 && strcmp(gsev,"yes")==0)
printf("Loan has approved for you!");
else if(atime<5 && strcmp(gsev,"yes")==0)
printf("Loan hasn't approved.");
else if(atime<5 && strcmp(gsev,"no")==0)
printf("Loan hasn't approved.");
else if(atime>=5 && strcmp(gsev,"no")==0)
printf("Loan hasn't approved.");
getch();
}
write a program to print the following pattern using 1 loop(i.e. u can use a loop only once any loop)
2 4 6 8 10
1 3 5 7 9
Acc to gregarian calander it was monday on 01/01/01. If any year is input through the keyboard write a programme to find outwhat is the day on 1st january of this year
useful very useful
any one can give me an explanation for this string reverse program
i want C program using string to display
Input:KUMAR
Output: K1U2M3A4R5... anyone plz ...
Hey Surya Kumar Here is the Solution::
#include
#include
void main(){
char str[50];
int i=0;
clrscr();
printf("\nEnter a string::");
gets(str);
while(str[i]!='\0'){
printf("%c%d",str[i],i+1);
i++;
}
getch();
}
#include
#include
#include
void main()
{
char a[40],b[40];
int i,l;
cout<<"\nenter ur string";
gets(a);
l=strlen(a);
for(i=0;i<l;i++)
{
b[i]=a[l-(i+1)];
}
for(i=0;i<l;i++)
{
cout<<b[i];
}}
Wap to reverse I Am as I ma...
#include
#include
#include
int main()
{
int j,l,i;
char s[10];
printf("\n\nEnter the String to get reversed\n");
gets(s);// taking string in variable s
l=strlen(s);
printf("\n\nreverse string is \n");
for(j=l-1;j>=0;j--)
{
printf("%c",s[j]);
}
getch();
}
would you please tell me how to check wheather the string is palindrome or not using for loop
#include
#include
int main()
{
int a[]={1,2,3,4,5,6},n,i=0,flag,j=0,b[25],p;
n=(sizeof(a)/sizeof(int));
flag=0;
for(i=0;i<=n;i++)
{
if(flag==0)
{
if(a[i]%2==0)
{
printf("%d\n",a[i]);
}
if(i==n)
{
flag=1;
i=0;
}
}
if(i<n)
{
if(flag==1)
{
if(a[i]%2!=0)
{
printf("%d\n",a[i]);
}
}
}
}
}
Using strrev function string and original string .then compare two function by strcmp and then give solution
second program has a mistake.. while (i>0) not >= because --i become -1 at the end
write a programme in c language:Enter a disordered string
the outpt alphabetic ordered string
my version:
void reverse(char* s, char* r)
{
r+=strlen(s);
*r--='\0';
while( *s )
*r-- = *s++;
}
hay Anjali thanx for submit this. here is solution for u
#include
#include
int main(){
char str[50];
char *rev;
printf("Enter any string : ");
scanf("%s",str);
rev = strrev(str);
printf("Reverse string is : %s",rev);
return 0;
}
Guys code for
Input: 12/02/1993
Output: 12-feb-1993
want prog ;
input : vector 123 india 567
output : vector 321 india 765
#include
int main()
{
int inc=2,i,j=0;
for(i=0;i<10;i++)
{
if(i==5)
{
printf("\n");
j=-1;
}
j+=inc;
printf("%d ",j);
}
}
Try this program. I hope this is the one you want.
#include
int main()
{
int i=0,j=0,spacepos=0;
char temp;
char str[]="I am Elangovan";
printf("%s\n",str);
for(i=0;str[i]!='\0';i++)
{
for(j=i;str[j]!=' '&&str[j]!='\0';j++);
spacepos=j;
j--;
for(;j>i;i++,j--)
{
temp=str[i];
str[i]=str[j];
str[j]=temp;
}
i=spacepos;
}
printf("%s\n",str);
}
@CHETAN, This might help you..
output:
---------
vector 123 india 567
vector 321 india 765
program:
---------------
#include
int main()
{
int i=0,j=0,spacepos=0,isnum;
char temp,ascii;
char str[]="vector 123 india 567";
printf("%s\n",str);
for(i=0;str[i]!='\0';i++)
{
isnum=1;
for(j=i;str[j]!=' '&&str[j]!='\0';j++)
{
ascii = str[j]-48;
if(!(ascii>=0 && ascii<=9))
isnum=0;
}
if(!isnum)
{
i=j;
continue;
}
spacepos=j;
j--;
for(;j>i;i++,j--)
{
temp=str[i];
str[i]=str[j];
str[j]=temp;
}
i=spacepos;
}
printf("%s\n",str);
}
@Amrut
output:
------------
12/02/1993
12-02-1993
program
--------------
#include
int main()
{
int i;
char str[]="12/02/1993";
printf("%s\n",str);
for(i=0;str[i]!='\0';i++)
{
str[i]=(str[i]=='/')?'-':str[i];
}
printf("%s\n",str);
}
Try this program to sort. this is like normal sorting algorithm. you can use any algorithm as you want to use with an integer array.
this program does not sort if capital letters present. In that case you have to convert the value to small letters while comparing. anyway this solves your basic question.
output:
----------
elangovan
aaeglnnov
program
--------------
#include
int main()
{
int i,j;
char temp;
char str[]="elangovan";
printf("%s\n",str);
for(i=0;str[i+1]!='\0';i++)
{
for(j=i+1;str[j]!='\0';j++)
{
if(str[i]>str[j])
{
temp=str[i];
str[i]=str[j];
str[j]=temp;
}
}
}
printf("%s\n",str);
}
Create a 1-D 25-elements character array named myString.
o Ask the user to input a string and store it in the array.
o Pass the string to a function named reverse, which prints the string in reverse order (without
using a temporary variable or using another array).
write a program that take input a name as array of character through pointer and print the address of each character in memory also print the address of pointer
Write a C program that take input 5 diferent student from user and save them in file using standard io by arranging them in ascending order by name while each record contain student's name seat no obtained marks and percentage
CAN ANYONE SOLVE THESE PROGARM.
.
1. Two Character strings may have many common substrings.
For example, photograph and tomography have several common substring of length one (i.e., single letters), and common substring ph, to, and ograph (as well as all the substrings of ograph). The maximum common substring length is 6.
(a) WAP to find the maximum common substring from given two strings and also find maximum common substring length.
2. Let L be an array of n distinct integers.
(a) WAP to find the length of a longest increasing subsequence of entries in L, For example if the entries are 11,17,5,8,6,4,7,12,3, then longest increasing subsequence is 5,6,7,12.
(b) How much time does your algorithm take?
3 Let X = x1x2…xn and Y = y1y2….yn be two character strings. We say that X is a cyclic shift of Y if there is some r such that X = y r+1…yny1…yr.
WAP to determine whether X is cyclic shift of Y or not.
1. Two Character strings may have many common substrings.
For example, photograph and tomography have several common substring of length one (i.e., single letters), and common substring ph, to, and ograph (as well as all the substrings of ograph). The maximum common substring length is 6.
(a) WAP to find the maximum common substring from given two strings and also find maximum common substring length.
@ Vikas Saxena..
#include
#include
#include
void main()
{
clrscr();
char a[40],b[40],c[40],d[40]="";
int i,w,x,p,j,k=0;
gets(a);
fflush(stdin);
gets(b); int h=1;i=0,j=0;
while(a[i]!=0)
{
p=i;
j=0;
while(b[j]!=0)
{
if(a[p]==b[j] && h==1)
{
c[k]=a[p];
k++;
p++;
}
else
{
if(a[p]==b[j+1])
{
h=1;
}
else
{
h=0;
}
}
j++;
}
c[k]=0;
w=strlen(d);
x=strlen(c);
if(x>w)
{
strcpy(d,c);
k=0;
}
if(x<w)
{
k=0;
p=i;
}
i++;
}
printf(" %s %d",d,w);
getch();
}
Write a C main program named as String_Occurences
Use necessary logic to find the occurrences of repeated alphabets in the input string. Note: Assume the input string as “GOOGLE”. anyone please help
#include
#include
#include
#include
void main()
{
char a[40],b[30],*p,*q,*r;
gets(a); int i=1;
p=a;
q=b;
while(*p!=0)
{
r=p+1;
while(*r!=0)
{
if(*p==*r)
{
i++;
*r=INT_MIN;
printf("%c %d\n",*p,i);
i=1;
}
r++;
}
p++;
}
getch();
}
output: G 2
O 2
Q: write a program to print following output from given input
input: aaa bbb ccc ddd eee fff ggg hhh iii jjj
output: bbb aaa ddd ccc fff eee hhh ggg jjj iii..Plz give me answer of this
write a programme using pointers,
input is string,
if i select position in a string
left side of the string is same
right side of the string will be reverse
any body help me
#include
#include
#include
void main()
{
clrscr();
char a[50],b[50],*p,*q,*r,*s;
gets(a);
int i=0;
strcat(a," ");
p=a;
s=b;
q=a;
while(*p!=0)
{
if(*(p+1)==' ')
{
if(i==0)
{
i=1;
p++;
}
else
{
r=p+2;
while(q!=p)
{
*s=*p;
s++;
//printf("%c",*p);
p--;
}
*s=*p;
s++;
//printf("%c ",*p);
q=r;
p=r;
*s=' ';
s++;
i=0;
}
}
else
{
p++;
}
}
s--;
*s=0;
strcpy(a,b);
printf("%s",a);
getch();
}
input: aaa bbb ccc ddd eee fff ggg hhh iii jjj
output: bbb aaa ddd ccc fff eee hhh ggg jjj iii
#include
#include
#include
void main()
{
clrscr();
char a[50],*p,*q,x;
gets(a);
int i=0,pos,length;
fflush(stdin);
printf("Enter the position\n");
scanf("%d",&pos);
p=a;
length=strlen(a);
q=p+(length-1);
while(*p!=0)
{
if(pos==i)
{
length=length-pos;
pos=length/2;
while(length!=pos)
{
x=*p;
*p=*q;
*q=x;
p++;
q--;
pos++;
}
break;
}
else
{
p++;
i++;
}
}
printf("%s",a);
getch();
}
input is: tishuabcdef
enter position: 4
output: tishfedcbau
tq tishu singh, nyc code
write a programme using pointers,
input is string,
i select position in a string
if position place is even the even places of characters will delete and print
same for odd also
any body help me
This is an Assignment Question from morpheus TMF1414 Sem1 2015/2016
678
123
049
write a c program , which will give o/p as 678394012
and generalize to for higher order matrix.
string s1=satya sting s2=tech
output is hscaettya
first letter string s2 reverse letter next sting s1 first letter
i want program
why did u used int i?
why did u used int i?
how to reverse a string in python
Assignment2
Write c program that reads 20 students.
1. New students
2. intermediate students
3. Senior student
If the number is not a 1 or a 2, we assume that it is a 3
If senior student>10 print
“High score”
how to create a c program of mirror number 5? please help me. not reverse .but mirror.
given a string char str[]="123456789";
write a program that display the following:
1
232
34543
4567654
567898765
Write a program that reads a string from user input and reverses the letter case of all characters in the string. Ignore numeric and special characters.
Help me to solve this.....
Declare and write a function that changes the value of the passed in argument, so that the caller of the function gets the changes from outside.
Help me to solve this.....
Declare and write a function that changes the value of the passed in argument, so that the caller of the function gets the changes from outside.
Give me ans.
What’s the name of the header file to include for using C++ style string in your program?
plzz tell me c program to print ur address
Anyone help me!!!Given a list of space separated words, reverse the order of the words.
Input :
this is a test
foobar
all your base
Output:
Case #1: test a is this
Case #2: foobar
Case #3: base your all
can anyone tell me hw to reverse a string and hw it work by using for loop
any one give me program of this statement ...
" suppose you have a main with three local arrays all the same size and type float the 1st two are initialize to value write a function called addarrays() that accept the addresses of three array as pointer location adds the constants 1st two array together element by element and places the result in third array and print third array before returning .."
pease mail me sson .. as early as possible ....
anyone please suggest me string reverse pgm
Input String:have a nice day
Output string:evha a ecni yad
#include
#include
void main()
{
char str[50];
int i;
printf("Enter any string=);
gets(str);
for(i=0;str[i]!=NULL; i++);
for(i=i-1; i>=0; i--)
{
printf("%c",str[i]);
}
getch();
}
Please tell in pattern programming
This is output
4
33
222
1111
I am sea
WAP to reverse a line as the following pattern :
Original : “LPU is located in punjab”
Reverse :” UPL si detacol ni bajnup”
#include
#include//WAP to check and print Armstrong Nos. between 1 to 500
int main()
{int i=1,t,temp,r=0,c=0,sum=0;
printf("Armstrong Nos. between 1 to 500 are:\n");
while(i<500)
{t=i;
while(t!=0)
{t=t/10;
c++;
}
temp=i;
while(temp!=0)
{r=temp%10;
sum=sum+pow(r,c);
temp=temp/10;
}
if(sum==i)
printf("%d",sum);
i++;
}
}
Can someone tell what is wrong with my code as I am getting only 1 as output.
Post a Comment