Here i have uploaded the previous year (2014 November) question paper of Programming in C for Third semester for Automobile Engineering, Mechanical Engineering, Production Engineering or Metallurgy branches under MG university BTech course.
Course : B.Tech Engineering (degree)
University: MG university (Mahatma Gandhi university) Kottayam, Kerala
Department or branch: Automobile Engineering, Mechanical Engineering, Production Engineering or Metallurgy
Information about resetting and configuring Mobile phones (Java, Android, Symbian etc), educational articles especially for programming in C, C++ and Java and more about Computers and operating systems
Showing posts with label C programming. Show all posts
Showing posts with label C programming. Show all posts
C Programming Previous Year Question Paper for Automobile, Mechanical, Production or Metallurgy
Labels:
$studymat
,
2014
,
Automobile
,
B TEch
,
B.Tech
,
BTech
,
c language
,
C programming
,
calicut
,
download
,
engineering
,
mechanical
,
MG University
,
pdf
,
previous
,
production
,
question paper
,
s3
,
semester
,
third
C Program For Insertion And Deletion In Heap
C program code for Insertion and Deletion in a Heap.
#include <stdio.h> #include<stdlib.h> int arr[100],n; void display(); void insert(int num,int loc); void del(int num);
C and C++ Programs for String Sorting
Here i am writing programs in c and c++ languages to sort a given number of strings. Sorting is carried out based on the ASCII values of the letters in the strings. The string comparing function strcmp() is used in the program. These programs sort a given set of strings in ascending order.To change it into descending order just replace > with < in comparison line. The comparison line in the code is marked by comment.
C Program:
C Program:
#include<stdio.h> #include<string.h> #include<conio.h> void main() {
Labels:
$ccpp
,
c language
,
c plus plus
,
C programming
,
C++
,
code
,
compiled code
,
compiled program
,
cpp
,
program
,
sorting
,
source code
,
string
,
string sorting
C and C++ swapping numbers
The following are C and C++ programs to swap the values of two variables using a third variable.
C Program:
C Program:
#include<stdio.h> void main() { int x,y,temp; printf("Enter the value of xand y\n"); scanf("%d%d", &x, &y); printf("Before Swapping\n x= %d\n y = %d\n",x,y); temp = x; x= y; y = temp; printf("After Swapping\n x= %d\ny= %d\n",x,y); }
2 Different C and C++ Programs to Check Whether a Given String is Palindrome or Not
Here i am writing two different programs to check whether a given string (text) us palindrome or not. There are C and C++ programs for this.
C Programs:
(i) Using string functions:
(ii) Comparing Character by Character
C++ Programs:
(i) Using String functions:
C Programs:
(i) Using string functions:
#include<stdio.h> #include<string.h> #include<conio.h> void main() { char a[100],b[100]; printf("Enter the string to check if palindrome or not\n"); gets(a); strcpy(b,a); strrev(b); if(strcmp(a,b)==0) printf("\nEntered string is palindrome"); else printf("\nEntered string is not palindrome"); getch(); }
(ii) Comparing Character by Character
#include<string.h> #include<stdio.h> #include<conio.h> void main() { int len,i; char a[100]; printf("Enter the string to check whether it is palindrome or not\n"); gets(a); len=strlen(a); for(i=0;i<len/2;i++) { if(a[i]!=a[len-i-1]) break; } if(i==len/2) printf("\nEntered string is palindrome"); else printf("\nEntered string is not palindrome"); getch(); }
C++ Programs:
(i) Using String functions:
Labels:
$ccpp
,
c language
,
c plus plus
,
C programming
,
C++
,
code
,
coding
,
cpp
,
programming
,
programming language
,
programs
,
project
,
source code
C program to Calculate Permutations and Combinations (nPr and nCr)
This is a C program to calculate total number of permutations and combinations for given values of n and r. This program calculates nPr and nCr using functions.
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
long double fact( int);
int ncr( int ,int);
long npr( int ,int);
main()
{
int n,r;
printf(" Enter value of n & r \n");
scanf("%d %d",&n ,&r);
if( n>= r)
{
printf( "%d C %d is %d \n",n,r,ncr( n ,r));
printf("%d P %d is %ld\n",n,r,npr( n, r));
}
else
{
printf("\n n should be greater than r");
getch ();
exit(0);
}
}
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
long double fact( int);
int ncr( int ,int);
long npr( int ,int);
main()
{
int n,r;
printf(" Enter value of n & r \n");
scanf("%d %d",&n ,&r);
if( n>= r)
{
printf( "%d C %d is %d \n",n,r,ncr( n ,r));
printf("%d P %d is %ld\n",n,r,npr( n, r));
}
else
{
printf("\n n should be greater than r");
getch ();
exit(0);
}
}
C and C++ Program to Display Pascal's Triangle
This post gives C and C++ programs to display given number of rows of pascal's triangle. Thenuser can enter the number of rows of pascal triangle to be displayed.
C Program:
C Program:
#include<stdio.h> #include<conio.h> long factorial(int); main() { int i, n, c; printf("Enter the number of rows you wish to see in pascal triangle\n"); scanf("%d", &n); for (i = 0; i < n; i++) { for (c = 0; c <= (n - i - 2); c++) printf(" "); for (c = 0; c <= i; c++) printf("%ld ", factorial(i) / (factorial(c) * factorial(i - c))); printf("\n"); } getch(); }
Labels:
$ccpp
,
c language
,
c plus plus
,
C programming
,
code
,
coding
,
cpp
,
display
,
pascal's
,
pascals
,
source code
,
triangle
Subscribe to:
Posts
(
Atom
)