C | Indian Shout

You are here: » Posts for tag C

C PROGRAM TO FIND LENGTH OF A STRING

Posted by 0 Responses

/* Write a c program to find the length of a string without using the built-in function  */ #include <stdio.h> void main() { char string[50]; int  i, length = 0; printf("Enter a string\n"); gets(string); for (i=0; string[i] != '\0'; i++) /*keep going through each */ {                                 /*character of the string */ length++;                    ... [ Continue reading... ]

Jun
7
2010

C PROGRAM TO CONCATENATE TWO STRINGS

Posted by 0 Responses

/* Program to accept two strings and concatenate them  i.e.The second string is appended to the end of the first string */  #include <stdio.h>  #include <string.h>  void main()  {      char string1[20], string2[20];      int i,j,pos;      strset(string1, '\0'); /*set all occurrences in two strings to NULL*/      strset(string2,'\0');      printf("Enter the first string :");     ... [ Continue reading... ]

Jun
7
2010

C PROGRAM TO COMPARE TWO STRINGS

Posted by 0 Responses

/* Program to accepts two strings and compare them. Finally it prints whether both are equal, or first string is greater than the second  or the first string is less than the second string   */ #include<stdio.h> #include<conio.h> void main() { int count1=0,count2=0,flag=0,i; char str1[10],str2[10]; clrscr(); puts("Enter a string:"); gets(str1); puts("Enter another string:"); gets(str2); /*Count the number of... [ Continue reading... ]

Jun
7
2010

C PROGRAM TO SWAP TWO NUMBERS

Posted by 1 Response

/*    Write a c program to swap the contents of two numbers using bitwise XOR operation. Don't use either the temporary variable or arithmetic operators  */  #include <stdio.h>  void main()  { long i,k; printf("Enter two integers\n"); scanf("%ld %ld",&i,&k); printf("\nBefore swapping i= %ld and k = %ld",i,k); i = i^k; k = i^k; i = i^k; printf("\nAfter swapping i= %ld and k =... [ Continue reading... ]

Jun
7
2010

C PROGRAM TO FIND WHETHER A GIVEN YEAR IS LEAP YEAR OR NOT

Posted by 3 Responses

/* Write a c program to find whether a given year is leap year or not  */  #include <stdio.h>  void main()  { int year; printf("Enter a year\n"); scanf("%d",&year); if ( (year % 4) == 0)   printf("%d is a leap year",year); else   printf("%d is not a leap year\n",year);  } /*------------------------------------------ Output Enter a year 2000 2000 is a  leap year RUN2 Enter a year 2007 2007 is not a leap... [ Continue reading... ]

Jun
7
2010

C PROGRAM TO CONVERT DECIMAL TO BINARY NUMBER AND COUNT NUMBER OF 1′S IN IT

Posted by 1 Response

/* Write a C program to accept a decimal number and convert it binary  and count the number of 1's in the binary number   */ #include <stdio.h> void main() { long num, dnum, rem, base = 1, bin = 0, no_of_1s = 0; printf("Enter a decimal integer\n"); scanf("%ld", &num); dnum = num; while( num > 0 ) { rem = num % 2; if ( rem == 1 )     /*To count no.of 1s*/ { no_of_1s++; } bin = bin + rem *... [ Continue reading... ]

May
14
2010

C PROGRAM TO COMPUTE THE SURFACE AREA AND VOLUME OF THE CUBE

Posted by 0 Responses

/*   Write a c program to compute the surface area and volume of a cube  */ #include <stdio.h> #include <math.h> void main() { float  side, surfArea, volume; printf("Enter the length of a side\n"); scanf("%f", &side); surfArea = 6.0 * side * side; volume = pow (side, 3); printf("Surface area = %6.2f and Volume = %6.2f\n", surfArea, volume); ... [ Continue reading... ]

May
14
2010

C PROGRAM TO ACCEPT STRING & SUBSTRING AND CHECK SUBSTRING PRESENT IN STRING OR NOT

Posted by 1 Response

/* Write a C program to accept a string and a substring and check if the substring is present in the given string */ #include<stdio.h> #include<conio.h> void main() { char str[80],search[10];     int count1=0,count2=0,i,j,flag; clrscr(); puts("Enter a string:"); gets(str); puts("Enter search substring:"); gets(search); while (str[count1]!='\0') count1++; while (search[count2]!='\0') ... [ Continue reading... ]

May
14
2010

C PROGRAM TO ACCEPT AN INTEGER AND REVERSE IT

Posted by 0 Responses

/* Write a C program to accept an integer and reverse it */ #include <stdio.h> void main() { long  num, rev = 0, temp, digit; printf("Enter the number\n");  /*For better programming,choose 'long int' */ scanf("%ld", &num); temp = num; while(num > 0) { digit = num % 10; rev = rev * 10 + digit; num /= 10; } printf("Given number   = %ld\n", temp); printf("Its reverse is = %ld\n",... [ Continue reading... ]

May
14
2010

C PROGRAM TO INSERT A PARTICULAR ELEMENT IN A SPECIFIED POSITION IN GIVEN ARRAY

Posted by 0 Responses

/* Write a C program to insert a particular element in a specified position  in a given array   */ #include <stdio.h> #include <conio.h> void main() { int  x[10]; int  i, j, n, m, temp, key, pos; clrscr(); printf("Enter how many elements\n"); scanf("%d", &n); printf("Enter the elements\n"); for(i=0; i<n; i++) { scanf("%d", &x[i]); } printf("Input array elements are\n"); for(i=0;... [ Continue reading... ]

May
14
2010

C PROGRAM TO ACCEPT N INTEGERS AND STORE THEM IN AN ARRAY

Posted by 1 Response

/* Program to accept N integer number and store them in an array AR. * The odd elements in the AR are copied into OAR and other elements * are copied into EAR. Display the contents of OAR and EAR */ #include <stdio.h> void main() { long int ARR[10], OAR[10], EAR[10]; int i,j=0,k=0,n; printf("Enter the size of array AR\n"); scanf("%d",&n); printf("Enter the elements of the array\n"); for(i=0;i<n;i++) { ... [ Continue reading... ]

May
14
2010

C PROGRAM TO CONVERT BINARY NUMBER TO DECIMAL

Posted by 0 Responses

/* Write a C program to convert the given binary number into decimal */ #include <stdio.h> void main() { int   num, bnum, dec = 0, base = 1, rem ; printf("Enter a binary number(1s and 0s)\n"); scanf("%d", &num);           /*maximum five digits */ bnum = num; while( num > 0) { rem = num % 10; dec = dec + rem * base; num = num / 10 ; base = base * 2; } printf("The Binary number is =... [ Continue reading... ]

May
13
2010

DIET CET 2010 ANSWER KEY

Posted by 0 Responses

DIET CET 2010 ANSWER KEY DIPLOMA IN EDUCATION AND TRAINING COMMON ENTRANCE TEST (DIET CET 2010) DIET CET 2010 FINAL CORRECT ANSWER KEY .Pdf file contains all Booklet Codes A,B,C,D answer keys.. CLICK HERE TO DOWNLOAD DIET CET 2010 ANSWER KEY ALL THE... [ Continue reading... ]

May
3
2010

JNTU B.TECH C LAB PROGRAMS

Posted by 0 Responses

JNTU B.TECH C LAB PROGRAMS   CLICK HERE TO DOWNLOAD C- Programs for... [ Continue reading... ]

Apr
25
2010
 
Search
Free Email Updates
Get All Latest Updates in Ur e-mail Inbox..

And then confirm your email subcription

Free SMS Alerts
Sponsored Links
Copy Protected by Chetans WP-Copyprotect.