Wednesday, December 1, 2010
demo
.fieldsetOut{
background:#1E90FF;
padding:0px 0px 0px 0px;
font-family: "courier new"
}
.fieldsetIn{
background:white;
margin:1px 1px 1px 1px;
padding:1px 1px 1px
How to generate random numbers in c
.fieldsetOut{
background:#1E90FF;
padding:0px 0px 0px 0px;
font-family: "courier new"
}
.fieldsetIn{
background:white;
margin:1px 1px 1px 1px;
padding:1px 1px 1px 1px;
border: 0px 0px 0px 0px
}
.explanation{
color:#800000;
font-size:25px;
font-weight:900;
letter-spacing:15
}
How to generate
random numbers in c
C code
to generate random numbers
#include
How to convert string to int in c
.fieldsetOut{
background:#1E90FF;
padding:0px 0px 0px 0px;
font-family: "courier new"
}
.fieldsetIn{
background:white;
margin:1px 1px 1px 1px;
padding:1px 1px 1px
How to reverse a string in c
.fieldsetOut{
background:#1E90FF;
padding:0px 0px 0px 0px;
font-family: "courier new"
}
.fieldsetIn{
background:white;
margin:1px 1px 1px 1px;
padding:1px 1px 1px 1px;
border: 0px 0px 0px 0px
}
.explanation{
color:#800000;
font-size:25px;
font-weight:900;
letter-spacing:15
}
C programming
language code to reverse any string
#include
#include
How to print in c
.fieldsetOut{
background:#1E90FF;
padding:0px 0px 0px 0px;
font-family: "courier new"
}
.fieldsetIn{
background:white;
margin:1px 1px 1px 1px;
padding:1px 1px 1px
How to declare an array in c
.fieldsetOut{
background:#1E90FF;
padding:0px 0px 0px 0px;
font-family: "courier new"
}
.fieldsetIn{
background:white;
margin:1px 1px 1px 1px;
padding:1px 1px 1px
How to initialize an array in c
.fieldsetOut{
background:#1E90FF;
padding:0px 0px 0px 0px;
font-family: "courier new"
}
.fieldsetIn{
background:white;
margin:1px 1px 1px 1px;
padding:1px 1px 1px
How to write to a file in c
.fieldsetOut{
background:#1E90FF;
padding:0px 0px 0px 0px;
font-family: "courier new"
}
.fieldsetIn{
background:white;
margin:1px 1px 1px 1px;
padding:1px 1px 1px
How to open a file in c
.fieldsetOut{
background:#1E90FF;
padding:0px 0px 0px 0px;
font-family: "courier new"
}
.fieldsetIn{
background:white;
margin:1px 1px 1px 1px;
padding:1px 1px 1px
How to read a file in c
.fieldsetOut{
background:#1E90FF;
padding:0px 0px 0px 0px;
font-family: "courier new"
}
.fieldsetIn{
background:white;
margin:1px 1px 1px 1px;
padding:1px 1px 1px
How to write a code in c
.fieldsetOut{
background:#1E90FF;
padding:0px 0px 0px 0px;
font-family: "courier new"
}
.fieldsetIn{
background:white;
margin:1px 1px 1px 1px;
padding:1px 1px 1px
Write a c program to convert binary to decimal
.fieldsetOut{
background:#1E90FF;
padding:0px 0px 0px 0px;
font-family: "courier new"
}
.fieldsetIn{
background:white;
margin:1px 1px 1px 1px;
padding:1px 1px 1px
Write a c program to multiply two matrices
.fieldsetOut{
background:#1E90FF;
padding:0px 0px 0px 0px;
font-family: "courier new"
}
.fieldsetIn{
background:white;
margin:1px 1px 1px 1px;
padding:1px 1px 1px 1px;
border: 0px 0px 0px 0px
}
.explanation{
color:#800000;
font-size:25px;
font-weight:900;
letter-spacing:15
}
#include
int main(){
int a[5][5],b[5][5],c[5][5];
int i,j,k,sum=0,m,n,o,p
Write a c program to find prime numbers
.fieldsetOut{
background:#1E90FF;
padding:0px 0px 0px 0px;
font-family: "courier new"
}
.fieldsetIn{
background:white;
margin:1px 1px 1px 1px;
padding:1px 1px 1px 1px;
border: 0px 0px 0px 0px
}
.explanation{
color:#800000;
font-size:25px;
font-weight:900;
letter-spacing:15
}
Write a program to find
prime numbers in c programming language. Source code:
#include<
Write a c program to find the roots of a quadratic equation
#include
#include
int main(){
int a,b,c;
double x,y,d;
printf("Enter a
, b , c of quadratic equation: ");
scanf("%d%d%d",&a,&b,&c);
//calculating
the value of d
d
= sqrt(b * b - 4 * a * c);
//Checking
real solution is possible or not
if(d<0){
printf("Real
number root is not possible");
exit(1);
}
Write a c program to reverse a string
.fieldsetOut{
background:#1E90FF;
padding:0px 0px 0px 0px;
font-family: "courier new"
}
.fieldsetIn{
background:white;
margin:1px 1px 1px 1px;
padding:1px 1px 1px 1px;
border: 0px 0px 0px 0px
}
.explanation{
color:#800000;
font-size:25px;
font-weight:900;
letter-spacing:15
}
Reverse a string
in c without using temp
String reverse
using strrev in c programming
Write a c program to reverse a number
Code 1:
1. Write a c program to reverse a given number
2. C program to find reverse of a number
3. C program to reverse the digits of a number
4. Reverse of a number in c using while loop
#include
int main(){
int num,r,reverse=0;
printf("Enter any number: ");
scanf("%d",&num);
while(num){
r=num%10;
reverse=reverse*10+r;
Write a c program to print Pascal triangle
.fieldsetOut{
background:#1E90FF;
padding:0px 0px 0px 0px;
font-family: "courier new"
}
.fieldsetIn{
background:white;
margin:1px 1px 1px 1px;
padding:1px 1px 1px 1px;
border: 0px 0px 0px 0px
}
.explanation{
color:#800000;
font-size:25px;
font-weight:900;
letter-spacing:15
}
#include
int main(){
int length,i,j,k;
//Accepting length from user
Write a c program that accepts a month and day
.fieldsetOut{
background:#1E90FF;
padding:0px 0px 0px 0px;
font-family: "courier new"
}
.fieldsetIn{
background:white;
margin:1px 1px 1px 1px;
padding:1px 1px 1px
Tuesday, July 20, 2010
warning: return type of �main� is not �int�
When we will compile a c program we may get following error message:
warning: return type of �main� is not �int�
Solution:
Cause of this warning message is return type of main function is not int. It is necessary to return an int value by main function. If main function returns 0 then operating system treat it as success.
For example:
int main(){
//Write your c code.
}
undefined reference to `sqrt' collect2: ld returned 1 exit status
When we will compile a c program in Linux GCC compiler we may get error message:
undefined reference to `sqrt' collect2: ld returned 1 exit status
Cause of this error is by default math.h library has not included.
Solution:
Compile the c code in the following way:
[root@localhost ~]# gcc abc.c -lm
Note: Here abc.c is name of any c code file.
undefined reference to `sqrt' collect2: ld returned 1 exit status
Cause of this error is by default math.h library has not included.
Solution:
Compile the c code in the following way:
[root@localhost ~]# gcc abc.c -lm
Note: Here abc.c is name of any c code file.
undefined reference to `pow' collect2: ld returned 1 exit status
In Linux GCC compiler when we compile a c program may get error message:
Error message: undefined
reference to `pow' collect2: ld returned 1 exit status
Compiler:
Linux gcc
Solution:
Cause of this error is
by default math.h library has not included. So compile the c code in following
way:
[root@localhost ~]# gcc
abc.c -lm
Note: Here abc.c is name
of any c code file.
Monday, July 5, 2010
Advanced c tutorial
Advanced
c concepts or tutorial. It explains advanced c programming by example. It also
includes advanced c language interview questions and answers for experienced.
System Level programming by c program
Write a c program to display mouse pointer
Mouse programming in c
Cursor program by c programming.
How to create virus in c?
How to create dos command in c?
Create dir command in c
If an employee spends 30% of his salary on fooding, 10% on clothing and 15% on other work. In this way he saves 10000 per month. Write a c program to find his total salary.
.fieldsetOut{
background:#1E90FF;
padding:0px 0px 0px 0px;
font-family: "courier new"
}
.fieldsetIn{
background:white;
margin:1px 1px 1px 1px;
padding:1px 1px 1px
C program to print all odd numbers between 1 and 100
.fieldsetOut{
background:#1E90FF;
padding:0px 0px 0px 0px;
font-family: "courier new"
}
.fieldsetIn{
background:white;
margin:1px 1px 1px 1px;
padding:1px 1px 1px 1px;
border: 0px 0px 0px 0px
}
.explanation{
color:#800000;
font-size:25px;
font-weight:900;
letter-spacing:15
}
#include
int main(){
int i;
for(i=1;i<100;i=i+2){
printf("%d\n"
C program for sum of even numbers from 1 to 100
.fieldsetOut{
background:#1E90FF;
padding:0px 0px 0px 0px;
font-family: "courier new"
}
.fieldsetIn{
background:white;
margin:1px 1px 1px 1px;
padding:1px 1px 1px
compound interest program in c
.fieldsetOut{
background:#1E90FF;
padding:0px 0px 0px 0px;
font-family: "courier new"
}
.fieldsetIn{
background:white;
margin:1px 1px 1px 1px;
padding:1px 1px 1px
c code for division of two complex numbers
.fieldsetOut{
background:#1E90FF;
padding:0px 0px 0px 0px;
font-family: "courier new"
}
.fieldsetIn{
background:white;
margin:1px 1px 1px 1px;
padding:1px 1px 1px
c code for multiplication of two complex numbers
.fieldsetOut{
background:#1E90FF;
padding:0px 0px 0px 0px;
font-family: "courier new"
}
.fieldsetIn{
background:white;
margin:1px 1px 1px 1px;
padding:1px 1px 1px
Write a c program to find the sum of first and last digit of any number
.fieldsetOut{
background:#1E90FF;
padding:0px 0px 0px 0px;
font-family: "courier new"
}
.fieldsetIn{
background:white;
margin:1px 1px 1px 1px;
padding:1px 1px 1px
C program to find average and percentage of marks in five different subjects.
.fieldsetOut{
background:#1E90FF;
padding:0px 0px 0px 0px;
font-family: "courier new"
}
.fieldsetIn{
background:white;
margin:1px 1px 1px 1px;
padding:1px 1px 1px 1px;
border: 0px 0px 0px 0px
}
.explanation{
color:#800000;
font-size:25px;
font-weight:900;
letter-spacing:15
}
C program to find average and percentage of marks in five different subjects.
#include
Write a c program to add two very large numbers
Write a c program to add two very large or big numbers
.fieldsetOut{
background:#1E90FF;
padding:0px 0px 0px 0px;
font-family: "courier new"
}
.fieldsetIn{
background:white;
margin:1px 1px 1px 1px;
padding:1px 1px 1px 1px;
border: 0px 0px 0px 0px
}
.explanation{
color:#800000;
font-size:25px;
font-weight:900;
letter-spacing:15
}
#include
#include
.fieldsetOut{
background:#1E90FF;
padding:0px 0px 0px 0px;
font-family: "courier new"
}
.fieldsetIn{
background:white;
margin:1px 1px 1px 1px;
padding:1px 1px 1px 1px;
border: 0px 0px 0px 0px
}
.explanation{
color:#800000;
font-size:25px;
font-weight:900;
letter-spacing:15
}
#include
#include
Write a c program which takes distance between two cities in k.m. a and convert it in meter,c.m.,inch and feet.
.fieldsetOut{
background:#1E90FF;
padding:0px 0px 0px 0px;
font-family: "courier new"
}
.fieldsetIn{
background:white;
margin:1px 1px 1px 1px;
padding:1px 1px 1px
Write a c program to find volume of a cone
.fieldsetOut{
background:#1E90FF;
padding:0px 0px 0px 0px;
font-family: "courier new"
}
.fieldsetIn{
background:white;
margin:1px 1px 1px 1px;
padding:1px 1px 1px
Write a c program to find volume and surface area of a cube
.fieldsetOut{
background:#1E90FF;
padding:0px 0px 0px 0px;
font-family: "courier new"
}
.fieldsetIn{
background:white;
margin:1px 1px 1px 1px;
padding:1px 1px 1px
C program to find out area of trapezium
.fieldsetOut{
background:#1E90FF;
padding:0px 0px 0px 0px;
font-family: "courier new"
}
.fieldsetIn{
background:white;
margin:1px 1px 1px 1px;
padding:1px 1px 1px 1px;
border: 0px 0px 0px 0px
}
.explanation{
color:#800000;
font-size:25px;
font-weight:900;
letter-spacing:15
}
1. C program or source code for find area of
trapezium
2. How to calculate area of trapezium
C program to find area of an equilateral triangle
.fieldsetOut{
background:#1E90FF;
padding:0px 0px 0px 0px;
font-family: "courier new"
}
.fieldsetIn{
background:white;
margin:1px 1px 1px 1px;
padding:1px 1px 1px 1px;
border: 0px 0px 0px 0px
}
.explanation{
color:#800000;
font-size:25px;
font-weight:900;
letter-spacing:15
}
C
program to find area of equilateral triangle
How
to calculate area of an equilateral
c program to find area of right angled triangle
.fieldsetOut{
background:#1E90FF;
padding:0px 0px 0px 0px;
font-family: "courier new"
}
.fieldsetIn{
background:white;
margin:1px 1px 1px 1px;
padding:1px 1px 1px
c program to find area rectangle
.fieldsetOut{
background:#1E90FF;
padding:0px 0px 0px 0px;
font-family: "courier new"
}
.fieldsetIn{
background:white;
margin:1px 1px 1px 1px;
padding:1px 1px 1px
c program to find area of triangle
.fieldsetOut{
background:#1E90FF;
padding:0px 0px 0px 0px;
font-family: "courier new"
}
.fieldsetIn{
background:white;
margin:1px 1px 1px 1px;
padding:1px 1px 1px 1px;
border: 0px 0px 0px 0px
}
.explanation{
color:#800000;
font-size:25px;
font-weight:900;
letter-spacing:15
}
C
program to find area of triangle
C
program to calculate area of triangle
#include<
Friday, July 2, 2010
C interview questions pdf
C Programming language fresher or beginner interview questions and answers in PDF format free to download
1. C interview questions pdf
2. C questions and answers
3. C pointer questions pdf
4. C objective questions pdf
C questions and answers pdf
1. C interview questions pdf
2. C questions and answers pdf
3. C pointer questions pdf
4. C objective questions pdf
Thursday, July 1, 2010
pointers questions pdf
C
programming language objective type questions and answers with explanation on
pointers for interview and written test quiz exam in pdf format free download
1. C interview questions pdf
2. C questions and answers
3. C pointer questions pdf
4. C objective questions pdf
If you have any queries or suggestions on above c
tricky pointers questions pdf, please share it.
Saturday, June 19, 2010
Write a c program to find out second smallest element of an unsorted array
.fieldsetOut{
background:#1E90FF;
padding:0px 0px 0px 0px;
font-family: "courier new"
}
.fieldsetIn{
background:white;
margin:1px 1px 1px 1px;
padding:1px 1px 1px 1px;
border: 0px 0px 0px 0px
}
.explanation{
color:#800000;
font-size:25px;
font-weight:900;
letter-spacing:15
}
C program to find the second
smallest element in an array
#include
int main()
Write a c program to find out the size and drive where file has stored of any given file?
#include "time.h"
#include "sys\stat.h"
#include "stdio.h"
int main(){
struct stat status;
FILE *fp;
fp=fopen("test.txt","r");
fstat(fileno(fp),&status);
printf("Size of file : %d",status.st_size);
printf("Drive name : %c",65+status.st_dev);
return 0;
}
Explanation:
Function int fstat (char *, struct stat *) store the information of open file in
#include "sys\stat.h"
#include "stdio.h"
int main(){
struct stat status;
FILE *fp;
fp=fopen("test.txt","r");
fstat(fileno(fp),&status);
printf("Size of file : %d",status.st_size);
printf("Drive name : %c",65+status.st_dev);
return 0;
}
Explanation:
Function int fstat (char *, struct stat *) store the information of open file in
Write a c program to know the last date of modification of any file
#include "time.h"
#include "sys\stat.h"
#include "stdio.h"
int main(){
struct stat status;
FILE *fp;
fp=fopen("test.txt","r");
fstat(fileno(fp),&status);
printf("Last date of modification : %s",ctime(&status.st_ctime));
return 0;
}
Explanation:
Function int fstat(char *, struct stat *) store the information of open file in form of structure struct
Write a c program to find out transport of a matrix
.fieldsetOut{
background:#1E90FF;
padding:0px 0px 0px 0px;
font-family: "courier new"
}
.fieldsetIn{
background:white;
margin:1px 1px 1px 1px;
padding:1px 1px 1px 1px;
border: 0px 0px 0px 0px
}
.explanation{
color:#800000;
font-size:25px;
font-weight:900;
letter-spacing:15
}
C program for transpose of a matrix
C program to find transpose of given matrix
#include<
Write a c program to print the string from given character
.fieldsetOut{
background:#1E90FF;
padding:0px 0px 0px 0px;
font-family: "courier new"
}
.fieldsetIn{
background:white;
margin:1px 1px 1px 1px;
padding:1px 1px 1px 1px;
border: 0px 0px 0px 0px
}
.explanation{
color:#800000;
font-size:25px;
font-weight:900;
letter-spacing:15
}
#include
#include
int main(){
char *p;
char s[20],s1[1];
Write a c program which prints initial of any name
.fieldsetOut{
background:#1E90FF;
padding:0px 0px 0px 0px;
font-family: "courier new"
}
.fieldsetIn{
background:white;
margin:1px 1px 1px 1px;
padding:1px 1px 1px 1px;
border: 0px 0px 0px 0px
}
.explanation{
color:#800000;
font-size:25px;
font-weight:900;
letter-spacing:15
}
C code which prints initial of any name
#include
int main(){
char str[20];
Write a c program to convert the string from lower case to upper case
.fieldsetOut{
background:#1E90FF;
padding:0px 0px 0px 0px;
font-family: "courier new"
}
.fieldsetIn{
background:white;
margin:1px 1px 1px 1px;
padding:1px 1px 1px 1px;
border: 0px 0px 0px 0px
}
.explanation{
color:#800000;
font-size:25px;
font-weight:900;
letter-spacing:15
}
Write
a c program to convert the string from lower case to upper case
#include
Write a c program to convert binary number to decimal number
.fieldsetOut{
background:#1E90FF;
padding:0px 0px 0px 0px;
font-family: "courier new"
}
.fieldsetIn{
background:white;
margin:1px 1px 1px 1px;
padding:1px 1px 1px 1px;
border: 0px 0px 0px 0px
}
.explanation{
color:#800000;
font-size:25px;
font-weight:900;
letter-spacing:15
}
C code for binary to decimal conversion:
#include
int main(){
Write a c program for swapping of two arrays
.fieldsetOut{
background:#1E90FF;
padding:0px 0px 0px 0px;
font-family: "courier new"
}
.fieldsetIn{
background:white;
margin:1px 1px 1px 1px;
padding:1px 1px 1px 1px;
border: 0px 0px 0px 0px
}
.explanation{
color:#800000;
font-size:25px;
font-weight:900;
letter-spacing:15
}
Write a c
program for swapping of two arrays
#include
int main(){
int a[10],b
Write a c program to find out L.C.M. of two numbers.
.fieldsetOut{
background:#1E90FF;
padding:0px 0px 0px 0px;
font-family: "courier new"
}
.fieldsetIn{
background:white;
margin:1px 1px 1px 1px;
padding:1px 1px 1px 1px;
border: 0px 0px 0px 0px
}
.explanation{
color:#800000;
font-size:25px;
font-weight:900;
letter-spacing:15
}
LCM program in c with two numbers :
#include
int main(){
int n1,n2,x,y;
Write a c program to find out NCR factor of given number
.fieldsetOut{
background:#1E90FF;
padding:0px 0px 0px 0px;
font-family: "courier new"
}
.fieldsetIn{
background:white;
margin:1px 1px 1px 1px;
padding:1px 1px 1px 1px;
border: 0px 0px 0px 0px
}
.explanation{
color:#800000;
font-size:25px;
font-weight:900;
letter-spacing:15
}
Write
a c program to find out NCR factor of given number Or
C program to find the ncr value by
Write a c program to print Pascal triangle.
.fieldsetOut{
background:#1E90FF;
padding:0px 0px 0px 0px;
font-family: "courier new"
}
.fieldsetIn{
background:white;
margin:1px 1px 1px 1px;
padding:1px 1px 1px 1px;
border: 0px 0px 0px 0px
}
.explanation{
color:#800000;
font-size:25px;
font-weight:900;
letter-spacing:15
}
1. Pascal
triangle in c without using array
2. C code
to print Pascal triangle
3.
Write a c program for Floyd�s triangle.
.fieldsetOut{
background:#1E90FF;
padding:0px 0px 0px 0px;
font-family: "courier new"
}
.fieldsetIn{
background:white;
margin:1px 1px 1px 1px;
padding:1px 1px 1px 1px;
border: 0px 0px 0px 0px
}
.explanation{
color:#800000;
font-size:25px;
font-weight:900;
letter-spacing:15
}
1. Write a
c program to print Floyd�s triangle
2. C
program to display Floyd�s triangle
Friday, June 18, 2010
Write a c program which passes two dimension array to function
.fieldsetOut{
background:#1E90FF;
padding:0px 0px 0px 0px;
font-family: "courier new"
}
.fieldsetIn{
background:white;
margin:1px 1px 1px 1px;
padding:1px 1px 1px 1px;
border: 0px 0px 0px 0px
}
.explanation{
color:#800000;
font-size:25px;
font-weight:900;
letter-spacing:15
}
How to pass two dimensional array to a function in c
#include
#define M 3
#
Write a c program to find largest among three numbers using conditional operator
.fieldsetOut{
background:#1E90FF;
padding:0px 0px 0px 0px;
font-family: "courier new"
}
.fieldsetIn{
background:white;
margin:1px 1px 1px 1px;
padding:1px 1px 1px 1px;
border: 0px 0px 0px 0px
}
.explanation{
color:#800000;
font-size:25px;
font-weight:900;
letter-spacing:15
}
Write
a c program to find largest among three numbers using conditional operator
#include<
Write a c program to find largest among three numbers using binary minus operator
.fieldsetOut{
background:#1E90FF;
padding:0px 0px 0px 0px;
font-family: "courier new"
}
.fieldsetIn{
background:white;
margin:1px 1px 1px 1px;
padding:1px 1px 1px 1px;
border: 0px 0px 0px 0px
}
.explanation{
color:#800000;
font-size:25px;
font-weight:900;
letter-spacing:15
}
#include
int main(){
int a,b,c;
printf("\nEnter
3 numbers: ");
Write a c program to check given string is palindrome number or not
.fieldsetOut{
background:#1E90FF;
padding:0px 0px 0px 0px;
font-family: "courier new"
}
.fieldsetIn{
background:white;
margin:1px 1px 1px 1px;
padding:1px 1px 1px 1px;
border: 0px 0px 0px 0px
}
.explanation{
color:#800000;
font-size:25px;
font-weight:900;
letter-spacing:15
}
#include
#include
int main(){
char *str,*rev;
int i,j;
printf("\
Write a c program to find out sum of digit of given number
.fieldsetOut{
background:#1E90FF;
padding:0px 0px 0px 0px;
font-family: "courier new"
}
.fieldsetIn{
background:white;
margin:1px 1px 1px 1px;
padding:1px 1px 1px 1px;
border: 0px 0px 0px 0px
}
.explanation{
color:#800000;
font-size:25px;
font-weight:900;
letter-spacing:15
}
Code 1:
1. C
program to add digits of a number
2. C
program for sum of digits of a
number
3.
Write a c program to check given number is strong number or not.
.fieldsetOut{
background:#1E90FF;
padding:0px 0px 0px 0px;
font-family: "courier new"
}
.fieldsetIn{
background:white;
margin:1px 1px 1px 1px;
padding:1px 1px 1px 1px;
border: 0px 0px 0px 0px
}
.explanation{
color:#800000;
font-size:25px;
font-weight:900;
letter-spacing:15
}
Code 1:
1. Write a c program to check whether a
number is strong or not
#include
Saturday, June 12, 2010
Array questions with explanation in c
C programming technical questions and answers with
explanation
Technical c
interview questions
1.
What will be output when you will execute following c code?
#include
void main(){
int check=2;
switch(check){
case 1: printf("D.W.Steyn");
case 2: printf("
Monday, June 7, 2010
How to read a text file by c program
.fieldsetOut{
background:#1E90FF;
padding:0px 0px 0px 0px;
font-family: "courier new"
}
.fieldsetIn{
background:white;
margin:1px 1px 1px 1px;
padding:1px 1px 1px
How to pass one dimensional array to function in c
.fieldsetOut{
background:#1E90FF;
padding:0px 0px 0px 0px;
font-family: "courier new"
}
.fieldsetIn{
background:white;
margin:1px 1px 1px 1px;
padding:1px 1px 1px 1px
Sunday, June 6, 2010
INSERT AN ELMENT IN AN ARRAY AT DESIRED POSITION USING C PROGRAM
How
to insert or add an element in the array at specific or desired posting by
using c programming language? Source code is as follow:
#include
int main(){
int
a[50],size,num,i,pos,temp;
printf("\nEnter
size of the array: ");
scanf("%d",&size);
printf("\nEnter
%d elements in to the array: ",size);
for(i=0;iscanf("%d",&a[i]);
printf("\nEnter position and number to insert: ");
FIND OUT GENERIC ROOT OF A NUMBER By C PROGRAM
C program for generic root
#include
int main(){
long int num,sum,r;
printf("\nEnter
a number:-");
scanf("%ld",&num);
while(num>10){
sum=0;
while(num){
r=num%10;
num=num/10;
sum+=r;
}
if(sum>10)
num=sum;
else
break;
}
printf("\nSum of
the digits in single digit is: %ld",sum);
return 0;
}
C code for calculation of generic root in one line
#include <
Check the given number is armstrong number or not using c program
Code 1:
1. Warp
to check a number is Armstrong
2. C program to check whether a number is Armstrong or not
3. Simple
c program for Armstrong number
4. Armstrong
number in c with output
#include
int main(){
int num,r,sum=0,temp;
printf("Enter a
number: ");
scanf("%d",&num);
temp=num;
while(num!=0){
r=num%10;
num=num/10;
C questions
C programming switch case questions and answers with
explanation
1.
What will be output when you will execute following c code?
#include
void main(){
int check=2;
switch(check){
case 1: printf("D.W.Steyn");
case 2: printf(" M.G.Johnson");
case 3:
Saturday, January 23, 2010
If else questions in c
If
else or control flow objective type questions and answers with explanation in c
language for written test or interview
1.
What will be output when you will execute following c code?
#include
void main(){
int a=5,b=10,c=1;
if(a&&b>c){
Monday, January 11, 2010
Write a C program that adds first seven terms of the following series 1/1! +2/2! + 3/3! + ..........
#include< stdio.h>
#include< conio.h>
int main( )
{
int n,i,j,fact;
float sum=0;
clrscr();
for(i=1; i<=7; i++) { fact=1; for(j=i; j>=1; j--) // to find the factorial
fact=fact*j;
sum=sum+(float)i/fact;
}
printf("\nSum : %f",sum);
getch();
return 0;
}
#include< conio.h>
int main( )
{
int n,i,j,fact;
float sum=0;
clrscr();
for(i=1; i<=7; i++) { fact=1; for(j=i; j>=1; j--) // to find the factorial
fact=fact*j;
sum=sum+(float)i/fact;
}
printf("\nSum : %f",sum);
getch();
return 0;
}
Write a C program to find a peculiar two digit number which is three times the sum of its digits?
example:- 27
=3(2+7)
=3(9)
=27
#include< stdio.h>
#include< conio.h>
int main()
{
int n,sum=0,rem,temp;
clrscr();
printf("Enter any two digit number:");
scanf("%d",&n);
for(temp=n;temp>0;temp=temp/10)
{
rem=temp%10;
sum=sum+rem;
}
if(n==(sum*3))
printf("\nIts a Peculiar two digit number");
else
printf("\nNot a Peculiar two digit number");
getch();
return 0;
}
=3(2+7)
=3(9)
=27
#include< stdio.h>
#include< conio.h>
int main()
{
int n,sum=0,rem,temp;
clrscr();
printf("Enter any two digit number:");
scanf("%d",&n);
for(temp=n;temp>0;temp=temp/10)
{
rem=temp%10;
sum=sum+rem;
}
if(n==(sum*3))
printf("\nIts a Peculiar two digit number");
else
printf("\nNot a Peculiar two digit number");
getch();
return 0;
}
Sunday, January 10, 2010
C programming tutorials
INDEX
Chapter 1 Memory map
Chapter 2 Data type
Chapter 3 Variables in c
Chapter 4 Operators and expression
Chapter 5 Control structure if else and switch case
C programming questions asked in interview
C questions commonly or frequently asked in
interview for freshers
Check given number is prime number or not using
Check the given number is Armstrong number or not
Check the given number is palindrome number or not
Checking leap year
Check string is palindrome or not
Passing one-dimensional array to a function
Create a file and store data in it
To passing 2-dimensional array to a
interview for freshers
Check given number is prime number or not using
Check the given number is Armstrong number or not
Check the given number is palindrome number or not
Checking leap year
Check string is palindrome or not
Passing one-dimensional array to a function
Create a file and store data in it
To passing 2-dimensional array to a
Subscribe to:
Posts (Atom)