Home › Forums › C Programming › Please help me
- This topic has 3 replies, 2 voices, and was last updated 16 years, 1 month ago by GWILouisaxwzkla.
- AuthorPosts
- November 17, 2008 at 5:37 am #2156DamarisReaganParticipant
1.C prog to find the sum of series 1+(1/3!)-(1/5!)+(1/7!) uptop 20 terms upto 3 decimal places.
2.C prog to find the sum of cubes of first n integers.
3.C prog to calculate the length of string without using strlen function.
4.C prog to read a text file and replace its content in such a way that only one word is found in each line.
5.Given 3 integers , write a C prog to find the minimum among these by pairwise comparison.
6.C prog to find the sum of series 1+x-((x^2)/2)+((x^3)/3)-((x^4)/4) upto 20 terms.
7.C prog to find the sum of series 1+(1/2!)-(1/3!)+(1/4!)-(1/5!)upto first n integers has to be evaluated.
8.C prog to verify whether a square matrix is symmetric or not .
9.A text file that stores number of students in a class, one per line exists.Write a C prog to read this file and write it in reverse order.
10.C prog to print the sum of series S=x-((x^3)/3!)+((x^5)/5!)+((x^7)/7!)+…..n terms - November 17, 2008 at 10:41 pm #3477GWILouisaxwzklaParticipant
Do you have a formula for the sum of the first series ( or the name ) ?
- November 18, 2008 at 1:15 am #3478GWILouisaxwzklaParticipant
3.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576<br />/****************************************************************<br />* File Name : c:programshelptempCG.cpp<br />* Date : November,17,2008<br />* Comments : new project<br />* Compiler/Assembler :<br />*<br />*<br />*<br />*<br />*<br />* Program Shell Generated At: 7:02:58 p.m.<br />=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/<br /><br /><br />#include < stdio.h ><br />//#include < string.h ><br />//#include < conio.h ><br />//#include < math.h ><br />//#include < iomanip ><br />//#include < ctype.h ><br />#define MAX_LENGTH 50<br /><br /><br /><br />//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ FUNCTION PROTOTYPES @@@@@@@@@@@@@@@@@@@@@@@@@@<br /><br />int strLength ( char * );<br /><br />//##################################################################################<br /><br /><br />//main function ******************************<br /><br />int main ( )<br />{<br /><br />char str [ MAX_LENGTH ];<br /><br />printf ( "Enter a string " );<br />scanf ( "%s" , str );<br />int lengthStr = strLength ( str );<br />printf ( "length of string %i n" , lengthStr );<br />return 0 ;<br />}<br /><br /><br />/******************************* FUNCTION DEFINITION ******************************<br /><br />Name : strLength<br />Parameters :<br /><br />char *<br /><br /><br />Returns: int type<br />Comments: string must be null terminated<br /><br /><br /><br />++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/<br />int strLength ( char * str )<br />{<br /><br />int i = 0;<br /><br />while ( str [ i ] != 0 )<br />{<br />i ++;<br />}<br /><br /><br />return i;<br />}<br /><br />2.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960<br />/****************************************************************<br />* File Name : c:programshelptempCG.cpp<br />* Date : November,17,2008<br />* Comments : new project<br />* Compiler/Assembler :<br />*<br />*<br />*<br />*<br />*<br />* Program Shell Generated At: 7:02:58 p.m.<br />=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/<br /><br /><br />#include < stdio.h ><br />//#include < string.h ><br />//#include < conio.h ><br />//#include < math.h ><br />//#include < iomanip ><br />//#include < ctype.h ><br /><br /><br /><br /><br />//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ FUNCTION PROTOTYPES @@@@@@@@@@@@@@@@@@@@@@@@@@<br /><br /><br /><br />//##################################################################################<br /><br /><br />//main function ******************************<br /><br />int main ( )<br />{<br /><br />int sLength;<br />int sum = 0;<br />int i = 1;<br />printf ( "Enter length of series " );<br />scanf ( "%i" , & sLength );<br /><br /><br />while ( i <= sLength )<br />{<br />sum = sum + ( i * i * i );<br />i ++;<br />}<br /><br />printf ( "the sum is %i n " , sum );<br /><br /><br /><br /><br /><br />}<br /><br /><br /> - November 18, 2008 at 11:39 pm #3479GWILouisaxwzklaParticipant
4.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061<br />/****************************************************************<br />* File Name : c:programshelptempCG.cpp<br />* Date : November,17,2008<br />* Comments : new project<br />* Compiler/Assembler :<br />*<br />*<br />*<br />*<br />*<br />* Program Shell Generated At: 7:02:58 p.m.<br />=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/<br /><br /><br />#include < stdio.h ><br />//#include < string.h ><br />//#include < conio.h ><br />//#include < math.h ><br />//#include < iomanip ><br />//#include < ctype.h ><br />#define MAX_LENGTH 50<br /><br /><br /><br />//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ FUNCTION PROTOTYPES @@@@@@@@@@@@@@@@@@@@@@@@@@<br /><br /><br /><br />//##################################################################################<br /><br /><br />//main function ******************************<br /><br />int main ( )<br />{<br /><br />FILE * file1 = fopen ( "c:\programs\data.txt", "r+" );<br />FILE * file2 = fopen ( "c:\programs\data2.txt", "w+" );<br />char word [ MAX_LENGTH ];<br /><br />if( file1 == 0 || file2 == 0 )<br />{<br />printf( "A file did not open n" );<br />return 1;<br />}<br /><br />fscanf ( file1 , "%s", & word );<br />while ( ! feof ( file1 ) )<br />{<br /><br />fprintf( file2 , word );<br />fprintf( file2 , "n" );<br />fscanf ( file1 , "%s", & word );<br />}<br />fclose ( file1 );<br />fclose ( file2 );<br />return 0;<br /><br />}<br />5.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263<br />/****************************************************************<br />* File Name : c:programshelptempCG.cpp<br />* Date : November,17,2008<br />* Comments : new project<br />* Compiler/Assembler :<br />*<br />*<br />*<br />*<br />*<br />* Program Shell Generated At: 7:02:58 p.m.<br />=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/<br /><br /><br />#include < stdio.h ><br />//#include < string.h ><br />//#include < conio.h ><br />//#include < math.h ><br />//#include < iomanip ><br />//#include < ctype.h ><br />#define MAX_LENGTH 50<br /><br /><br /><br />//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ FUNCTION PROTOTYPES @@@@@@@@@@@@@@@@@@@@@@@@@@<br /><br /><br /><br />//##################################################################################<br /><br /><br />//main function ******************************<br /><br />int main ( )<br />{<br /><br />int one , two , three , smallest;<br /><br />printf ( "enter an integer: " );<br />scanf ( "%i" , & one );<br />printf ( "enter an integer: " );<br />scanf ( "%i" , & two );<br />printf ( "enter an integer: " );<br />scanf ( "%i" , & three );<br /><br />if ( one < two )<br />smallest = one;<br />else<br />smallest = two;<br />if ( three < smallest )<br />smallest = three;<br /><br />printf ( "the smallest is %i n" , smallest );<br /><br /><br />}<br /><br /><br /><br /><br /><br />
- AuthorPosts
- The forum ‘C Programming’ is closed to new topics and replies.