Tag Archives: perform

Write a program that does not use the inbuilt string functions to perform the following: 10m Jun2006

Write a program that does not use the inbuilt string functions to perform the following: 10m Jun2006 (i) To compare two strings [codesyntax lang=”c”] #include<stdio.h> void main() { int str_cmp(char*,char*); char Str1[50],Str2[50]; int val; clrscr(); printf(“\nENTER FIRST STRING TO COMPARE : “); scanf(“%s”,&Str1); printf(“\nENTER SECOND STRING TO COMPARE : “); scanf(“%s”,&Str2); val=str_cmp(Str1,Str2); if(val==0) printf(“\nSTR1 IS… Read More »

Write the functions to perform the following : 10m Dec2005

Write the functions to perform the following : 10m Dec2005  To accept a string and print the rightmost “n” characters   #include<stdio.h> #include<string.h> #include<alloc.h> char *rightsub(char *,int n); void main() { char s1[20],s2[20],ch,*s; int n; clrscr(); printf(“enter the string s1:”); gets(s1); printf(“enter the no of characters to extract=”); scanf(“%d”,&n); s=rightsub(s1,n); printf(“\nright sub string: %s”,s); free(s); getch();… Read More »

Write the functions to perform the following : 10m Dec2005

Write the functions to perform the following : 10m Dec2005   (i) To find mn where m, n > 0 #include<stdio.h> void main() {  long int power(int,int);  int M,N;  long int RES;  printf(“ENTER M : “);  scanf(“%d”,&M);  printf(“ENTER N : “);  scanf(“%d”,&N);  RES=power(M,N);  printf(“\nRESULT IS %ld “,RES);  getch(); } long int power(int M,int N) {  long… Read More »