C program examples | Interview Complete List


It is C programming FAQ code examples to Crack Interview. It has C language basic and simple source code by examples. It has arranged just like c tutorials with examples. This post contains a big collection of examples of c program. If you have any doubt in the following c program examples you are free to ask.



Frequently asked c programs in interview

L.C.M and H.C.F.

Swapping

Conversion ( Number System )

6. Write a c program to convert octal number to hexadecimal number.
8. Write a c program to convert hexadecimal number to octal number.
9. Write a c program to convert hexadecimal number to decimal number.
10. Write a c program to convert binary number to octal number.

Conversion ( Unit )


String

3. Write a c program to delete the all consonants from given string.
Matrix

File

2.  Write a c program to delete a file.
3. Write a c program to copy a file from one location to other location.
6. Write a c program which writes string in the file.
Complex number
3. Write a c program for multiplication of two complex numbers.
4. Write a c program for division two complex numbers.

Series

6. Write a c program to find out the sum of given H.P.
Array

Sorting

5. Write a c program for heap sort.
7. Write a c program for shell sort.

Recursion

Size of data type

Using pointer

Searching

Area and volume

6. Write a c program to find the area of trapezium.     
7. Write a c program to find the area of rhombus.   
8. Write a c program to find the area of parallelogram.           

529 comments:

«Oldest   ‹Older   201 – 400 of 529   Newer›   Newest»
dev said...

thanx for this site

Unknown said...

#include
#include
void main()
{
long int num;
int d;
int x;
int count=0;
printf("enter the number");
scanf("%ld",&num);
printf("\n\nenter the digit you want to find the occurence");
scanf("%d",&d);
while(num!=0)
{
x=num%10;
num=num/10;
if(x==d)
{
count++;
}
}
printf("The %d occurs %d times in a %ld.",d,count,num);
getch();
}

Unknown said...

write a program in c to print the any character or digit in a 10th row 20th coloumn without using gotoxy or gotorc function?

Unknown said...

write a program in c to make the caps lock on?
write a program in c to make delete key=ctrl+alt+delete. means whenever someone press delete key it will be recognised as ctrl+alt+delete.

Unknown said...

write a program in c to make your own dos command?

Unknown said...

char far *v,*f?
do v and f both enjoy the pointer of type char far
or not?if yes then why and if no then why?

Anonymous said...

can you help me on how to make a program in c language that can convert metrics to english or vice versa?

sharma.sneha444@gmail.com said...

Write a programm, according to Gregorian Calendar, it was monday on the date 01/01/01. if any year is input through the keyboard so write a programm to find out what is the day on 1st january of this year.
by if else statements....

sharma.sneha444@gmail.com said...

hii frnd i am a begginer of C programming language .. i m studing "LET US C" by YASHVANT KANETKAR. but it seems so difficult .can anyone suggest me that how can i make my learning effective and easy.coz i want to make my carrier in programming ,i want to teach programming..so need help and suggestion how can i make my concept stronger of C programming.even i find difficulty to learn if-else statements...

Anonymous said...

to compute fibonacci number fib (n) by recursive process? pls tell this prgm soon..

Anonymous said...

1 5 9 7 3
5 5*5 5*9 5*7 5*3
4 4*5 4*9 4*7 4*3
9 9*5 9*9 9*7 9*3
3 3*5 3*9 3*7 3*3
2 2*5 2*9 2*7 2*3

we have given first row and first column and we have to write code for multiplication part.

Anonymous said...

#include
#include
void main()
{
clrscr();
int i,c=1,n,sum,series;
printf("Enter limit");
scanf("%d",&n);
printf("\n");
for(i=0;i<n;i++)
{
series=1.0/c;
sum=sum+series;
c++;
printf("%d",sum);
getch();
}

Unknown said...

pascal triangle prog
view of programm

Unknown said...

it's excellent

Unknown said...

how to find a random number in c with out using rand function , please reply to me ..............

madhu said...

write a program to find the power of 12 without using pow function ?

the output should be in the form of

2 power 12

3 power 12...so on ...

madhu said...

1,2,3,4,5,1,2,3,1,2,3,4,5......
separate the series like
1,,2,3,4,5 and a,2,3
and 1,2,3,4,5
ten find the sum of this series .. guys please help me ......

madhu said...

int i,j,k ;
i=0,j=1;
int fib (int);
printf("%d %d",i,j);
k=i+j;
printf("%d",k);
f=fib(n)
{
i=j;
j=k;
k=i+j;
return k;
}

studyembedded said...

Dear friend ...this is amazieg site ...any boday can learn C with the help of this webpage...thanks shring!!

Unknown said...

i generaly confused with pointer can u explai the concept of pointer piz......?

Anonymous said...

Write a program using recursion that prints the following series: 2,4,6,8,6,4,2 by using a storage class.

Unknown said...

plz help me to write dis program


declare two array A & B ,find (i)A intersection B and(ii)A union B

Unknown said...

CAN ANY1 TELL HW TO Write a program that keeps takes three strings as input namely the input string, pattern string and replacement string. Program finds the pattern in the input and replaces every occurrence of pattern with the replacement string as shown below. Nothing is done if pattern string is not found. RPLU ASAP...

Anonymous said...

This site has saved me so many times! truly grateful for such beautiful easy to understand code!

Unknown said...

please help me with this code.You will implement an algorithm that represents a simplified, two-player version of
blackjack (also known as “21”). A dealer shuffles cards and distributes them. The goal of
the game is to get as close to 21 as possible without going over 21. If the dealer or player
goes over 21, then that hand loses. If neither player not dealer have scored 21, then the
hand with the higher score wins

Anonymous said...

Really very good site...please tell me if there is a site for PHP too !!!

Anonymous said...

write a function prototyped below:
float single_tax(float*income);
the argument is taxable income,and the function returns the appropriate amount of tax.
the u.s federal income tax for single person in 1995 is computed according to the following rules:
if your taxable income but not over your tax is of the amount over
is over
$0 $23350 15% $0
23350 56550 $3502.50+28% 23350
56550 117950 12798.50+36% 56550
117950 256500 31832.50+36% 117950
256500 - 81710.50+39.6% 256550

i am not able to find solution for this.please help me anyone.

Anonymous said...

can u add programs for linked list..plzzzzzz

Unknown said...

pleazzzzzzzzzzzz can any one search a code for this
c code to solve knapsack problem using exhaustive brute force

Unknown said...

if found mail me ok
will be grateful to u

Anonymous said...

question1: write a array program where user enter the element of array and place the no in odd position which is
most repeated in array.
example:{f,l,k,f,o,j,p,j,f}
ans{f,l,f,f,f,j,f,j,f}

Unknown said...

M & N imports batteries from Japan. Each box that is imported has the following properties
How many dozen in the box
Manufacturer
Manufacture date
Name of batteries
Country of manufacture
Date of purchase
Dimension of the box in which the batteries are packed. The length, width and height of the box are the same
Cost price of a single box of batteries
The company hires containers of varying sizes based on how much they want to import. There are only three sizes/dimensions of containers to be hired. The container people levy a fee that is 1% the cost price of the box. Each type of battery occupies its own container. To maximize profit, the company makes sure it doesn’t transport batteries that are less half the container. If the boxes required are less, the order is cancelled. All batteries get into the country through Busia, a district that borders Kenya. Each and every box of batteries is levied a tax that is 10% the cost price. For Each box sold, the company would like to generate a profit of 20% the cost price. If one is buying, they can’t buy below 3 boxes. If the stock of batteries goes below a certain number, the system should notify the user of the system.
The company would like to implement an information system using C programming. Write a c program whose input may include the following but is not limited to that
1. Number of boxes to be imported.
2. Properties of the boxes to be put in the container as per the list above. (same in the same container)
3. The three dimensions of containers available for hire
4. How many boxes have been purchased
5. Number below which the system should request the company to purchase
Output can include the following but is not limited to that:
1. Which container is used for a given pack
2. How many boxes are available in stock
3. How much profit made assuming no other expenditures (apart from what has been indicated above)
4. How many boxes have been sold out
5. Which name of battery is selling the most
6. Which country is supplying the company with batteries most

Modules should include
1. Capital input
2. Sales
3. Transport
4. Main

Jishya said...

How do I find the error in the given program ????

Jishya said...

#include
#include
struct node
{
int studentid;
int marks;
struct node *next;
};

struct node* insertStudentRecord(struct node* start,int studentids,int markss) ;
int maximumMarkofStudent(struct node* start);
int studentIDwithMaximumMark(struct node*,int maxMark);

main()
{
struct node *start;
int studentids,maxMark,studentID;
int markss;
start=NULL;

printf("\nEnter the id of student :");
scanf("%d",&studentids);
do
{
printf("\nEnter the marks of student: \n");
scanf("%d",&markss);
start=insertStudentRecord(start,studentids,markss);
printf("\nEnter the id of student or press -1 to terminate: :");
scanf("%d",&studentids);
}while(studentids!=-1);

maxMark=maximumMarkofStudent( start);
printf("\nMaximum marks=%d",maxMark);
studentID=studentIDwithMaximumMark(start,maxMark);
printf("\nStudentID=%d",studentID);
}

struct node* insertStudentRecord(struct node* start,int studentids,int markss)
{
struct node *ptr,*temp;

ptr=(struct node*)malloc(sizeof(struct node));
EXPRESSION:1;
ptr->marks=markss;
ptr->next=NULL;

if(start==NULL)
start=ptr;

else
{
temp=start;
while(CONDITION:1)
{
temp=temp->next;
}
temp->next=ptr;
}

return start;
}

int maximumMarkofStudent(struct node* start)
{
struct node *temp;
int max=0;
temp=start;
max=temp->marks;

while(temp->next!=NULL)
{
temp=temp->next;
if(CONDITION:2)
max=temp->marks;
}

return max;
}

int studentIDwithMaximumMark(struct node *start, int maxMark)
{
struct node *temp;
temp=start;

while(CONDITION:3)
{
if(maxMark==temp->marks)
{
break;
}
else
temp=temp->next;
}
return temp->studentid;
}

Anonymous said...

M & N imports batteries from Japan. Each box that is imported has the following properties
How many dozen in the box
Manufacturer
Manufacture date
Name of batteries
Country of manufacture
Date of purchase
Dimension of the box in which the batteries are packed. The length, width and height of the box are the same
Cost price of a single box of batteries
The company hires containers of varying sizes based on how much they want to import. There are only three sizes/dimensions of containers to be hired. The container people levy a fee that is 1% the cost price of the box. Each type of battery occupies its own container. To maximize profit, the company makes sure it doesn’t transport batteries that are less half the container. If the boxes required are less, the order is cancelled. All batteries get into the country through Busia, a district that borders Kenya. Each and every box of batteries is levied a tax that is 10% the cost price. For Each box sold, the company would like to generate a profit of 20% the cost price. If one is buying, they can’t buy below 3 boxes. If the stock of batteries goes below a certain number, the system should notify the user of the system.
The company would like to implement an information system using C programming. Write a c program whose input may include the following but is not limited to that
1. Number of boxes to be imported.
2. Properties of the boxes to be put in the container as per the list above. (same in the same container)
3. The three dimensions of containers available for hire
4. How many boxes have been purchased
5. Number below which the system should request the company to purchase
Output can include the following but is not limited to that:
1. Which container is used for a given pack
2. How many boxes are available in stock
3. How much profit made assuming no other expenditures (apart from what has been indicated above)
4. How many boxes have been sold out
5. Which name of battery is selling the most
6. Which country is supplying the company with batteries most

Modules should include
1. Capital input
2. Sales
3. Transport
4. Main

Unknown said...

Write a program to find the prime numbers in a given range and print them in a text file.
Can u make dis code pls? pls hlp me

Unknown said...

awesome buddy....1 of the best sites to get expertice in c.....thanks a lot..

ಮಂಜಿನ ಹನಿ said...

Hope this might help you!

#include

int main()
{
int num[25], n,i,sum=0;
printf("Enter the number:\n");
scanf("%d", &num);

printf("Enter the number to be searched for Occurance:\n");
scanf("%d", &n);

for(i=0;i<sizeof(num);i++)
{
if(n==num[i])
sum++;
}

printf("The number of occurances of %d: %d", n, sum);
return 0;
}

- Prasad

Unknown said...

Write a program that takes a long string as input, and corrects the following:
a­ If there is a missing space, add it (there should always be a space after a comma or a
full­stop).
b­ If there is an extra space, remove it.
c­ If there is a letter that is wrongly capitalized, correct it.
d­ If there is a letter that should be capitalized and is not, correct it.
For example: “hello Every One, nice to Meet YOU.haVE a nice day” should be “Hello every one,
nice to meet you. Have a nice day”.
please help me
thanks

Unknown said...

Write a program that takes a long string as input, and corrects the following:
a­ If there is a missing space, add it (there should always be a space after a comma or a
full­stop).
b­ If there is an extra space, remove it.
c­ If there is a letter that is wrongly capitalized, correct it.
d­ If there is a letter that should be capitalized and is not, correct it.
For example: “hello Every One, nice to Meet YOU.haVE a nice day” should be “Hello every one,
nice to meet you. Have a nice day”.

Unknown said...

please help
thx

Unknown said...

didnt understand
pls enlignten

Unknown said...

write a program that will take the value from the keyboard , if the value is positive the program gives the message value positive and if the value is negative message print the value is negative

Unknown said...

how to write a c program to calculate valency of an element given the atomic no....

Unknown said...

Write a program to measure the idleness of the CPU

Unknown said...

pleasa help...
Write a c program to measure the idleness of the CPU

Himanshu Negi | Programming said...

Wow... great list of programs, Now we don't have to purchase any book.

Anonymous said...

Write a program to extract values in vgdisplay and calculate total disk space used in VG00,
where : total disk used = PE size * Alloc PE .

Anonymous said...

This the sample value of vgdisplay output.
--- Volume groups ---
VG Name /dev/vg00
VG Write Access read/write
VG Status available
Max LV 255
Cur LV 7
Open LV 7
Max PV 16
Cur PV 2
Act PV 2
Max PE per PV 4350
VGDA 4
PE Size (Mbytes) 4
Total PE 8680
Alloc PE 8650
Free PE 30
Total PVG 0
Total Spare PVs 0
Total Spare PVs in use 0

Anonymous said...

Please solve my problem..

Question:

There are multiple directions to reach from destination A to destination B.

In the two given destinations assume there are four different directions to start from destination A and reach destination B.

Delhi to Jaipur

1.Delhi->Gurgaon->Bhiwadi->Bawal->Macheri->Jaipur
2.Delhi->Faridabad-> Palwal ->Sohna->Bawal->Macheri->Jaipur
3.Delhi->Jhajjar->Rewari->Bawal->Macheri->Jaipur
4.Delhi->Sohna->Bawal->Macheri->Jaipur

Write a 'C' program to identify shortest route from destination A and destination B and also all the available routes from A to B. Note: A and B does not mean as Delhi & Jaipur, it could be any teo places given in the above routes.


Please please solve my problem.

Unknown said...

Please give me code for 9,19,29,39,49,59,69,79,89,99,109,.............

Anonymous said...

i need program that 4 load becomes on-off with push button. once the button pushed one load on and when nexttly push button pushed then off.

Anonymous said...

Please solve my problem..

Question:

There are multiple directions to reach from destination A to destination B.

In the two given destinations assume there are four different directions to start from destination A and reach destination B.

Delhi to Jaipur

1.Delhi->Gurgaon->Bhiwadi->Bawal->Macheri->Jaipur
2.Delhi->Faridabad-> Palwal ->Sohna->Bawal->Macheri->Jaipur
3.Delhi->Jhajjar->Rewari->Bawal->Macheri->Jaipur
4.Delhi->Sohna->Bawal->Macheri->Jaipur

Write a 'C' program to identify shortest route from destination A and destination B and also all the available routes from A to B. Note: A and B does not mean as Delhi & Jaipur, it could be any teo places given in the above routes.


Please please solve my problem.

Unknown said...

longint=968794869749.. Find the biggest number of this value and how many times occurs on that number?

Anonymous said...

write a program that prompts you to capture a number then displays its character (A-Z) equivalence.

Rajib said...

Really very good blog for help to us

MECHZONE12-16 said...

thanks brother for your help

Unknown said...

[Error] cannot convert 'int*' to 'char*' in assignment

Anonymous said...

wap to calculate equation of straight line using c

Unknown said...

thank you .... such a wonderful site learnt lot from it .. helpful for beginners like me .

Unknown said...

hi i am amani .......Please help me ...
write a program that display the menu below and uses a do loop to check for valid responses, (the program does not need to implement the actual function ,just for that :
Account Information :
1-Enter account number.
2-Enter user name.
3-Search the list.
4-Correct user name.
5-Quit
* Enter the number of your choice (1 to 5).

Unknown said...

can anybody tell me how to add numbers 1-100 into an array neither taking input from the user nor through array initialization plzzzz!!!!
let me knw if smebdy knows thank you........

Unknown said...

can anybody plzz tell me how to add 1-100 numbers in array by neither takin input from the user nor array initialization!!!!

Unknown said...

How to write the program for get output like this? Repeated letter print exactly one time only.
string="JEEVAN"
J
E E
V V V
A A A A
N N N N N

Unknown said...

How to print the matrix number like following way using array?

1 2 3 4
5 6 7 8
9 0 1 2
3 4 5 6

print 1234826543956710 (Top row, Then right column, then 4th row, then left column, Then 2nd row 2 element)

CProgrammer said...

Can u help me out with some programs?

1. Write a program which reads an array and determines if there are any repeated elements in it. The program prints the repeated elements with their frequency.

2. Write a program that reads a matrix and prints the elements of a row with the highest sum after having inverted all the elements of each cell.

3. Write a program that reads n letters from a text file and prints all the possible combinations of these letters.

4. Write a program that determines which letter of the alphabet is repeated the most in a text file.

Please, I have an exam tomorrow!!!

Unknown said...

Write a c program which reads a full line of text and prints number of words which start and end with a particular character

yoga said...

Remove consonants

#include
int main()
{
char str[100];
int i;
int count=0;
printf("\n Enter the string");
scanf("%s",str);
for(i=0;str[i]!='\0';i++)
{
count++;
if(str[i]=='a'||str[i]=='e'||str[i]=='i'||str[i]=='o'||str[i]=='u')
continue;
else
str[i]='\0';
}
printf("\n%d",count);
for(i=0;i<count;i++)
{
printf("%c",str[i]);
}
return 0;
}

Unknown said...

write a program to check the number is palindrom or not without function.
the site is awesome.

Unknown said...

please help me!
i want only two numbers from console screen in c;then what code will be needed?
reply me
hemantkonade25@gmail.com

Anonymous said...

plz give me code for add,sub,mul,division program using function

madhu said...

main()
{
int n,r=0,t,x;
clrscr();
printf("\n accept n value");
scanf("%d",&n);
x=n;
while(n!=0)
{
t=%10;
r=(r*10)*t;
n=n\10;
}
if(x==r)
prntf("\n palindrome");
else
prntf("\n not palindrome");
}
BY MADHU PAGIDIPALLI ANY halp.. madhupagidipalli@gmail.com

Anonymous said...

Write a program that searches the largest common sub string between two strings
For example:
abcyahyaezzeldinelnegm
yahyaezzelarabelhelaly
the expected output is yahyaezz

Unknown said...

i want to a program to change the selected characther with another selected character

Anonymous said...

Awesome site!!

Anonymous said...

thanq sooo much

it helped me to test my knowledge
thanks a lot

and i req. u to upload more programs abt c in depth

Unknown said...

please give me the c language code for following output
7
14 15
28 29 30 31
56 57 58 59 60 61 62 63

Unknown said...

Create a square box with asterix only on the perimeter .....Write the Cprogram plz help me on this

Anonymous said...

I need a method, Method should accept two parameters.
First parameter is first number to display, second parameter should be number of rows to be printed.
EX:
printseries(7,4)

Output should be:
7
14 15
28 29 30 31
56 57 58 59 60 61 62 63

Anonymous said...

write a c program to find abbreviation of name for example
INPUT: RAHUL KUMAR PANDEY
OUTPUT:R. K. PANDEY and if user input only name without title then output should be as shown below
INPUT: RAHUL
OUTPUT:RAHUL.

Mahima said...

Nice work. I believe u r the number one in c. But i did not found any reply/modification of problems from comments section. I have tried lot in my blog. i am expecting suggestions from you too..

Please visit: www.cprogramming-bd.com

mohima said...

Nice work. I believe u r the number one in c. But i did not found any reply/modification of problems from comments section. I have tried lot in my blog. i am expecting suggestions from you too..

Please visit: www.cprogramming-bd.com

Unknown said...

can u plz tell me how to solve this problem give me the code when we take the password it must show as a asterisk not the int taking input frm user do it by for and while loop plz..
like atm machine which shows the asterisk when we enter the pass

Anonymous said...

Take input of 10 numbers in an array and find out how many of them are prime number in the array.

Anonymous said...

write a program to check the no. is greater or equal to 500

Unknown said...

hi sir.. your blog is great!

Anonymous said...

Your codes are easy to understand :) Great help for me. Could you please make a program that will do r's and r-1 complement. please :)

Anonymous said...

pls ans..
create a program that will
a. r's and r-1's complement of decimal
b. r's and r-1's complement of binary
c. r's and r-1's complement of octal
d. r's and r-1's complement of hexadecimal

thanks a lot..

Anonymous said...

plzzzz send code for sorting the positive elements from the array

CSE TUBE said...

I have a matrix as usual For example
1 2 3
4 5 6
7 8 9

How to print the numbers inside it in the spiral way..
That is, 123698745 ?

The Code must also work for any n x n matrix also. Can u post it ?

Anonymous said...

Create a program that computes for the average of the numbers entered by the user. Getting of the input will only terminate if the user will enter a negative number.

Enter number: 30
Enter number: 40
Enter number: 28
Enter number: 90
Enter number: 68
Enter number: -20

Average is 51.

Anonymous said...

Write a “C1GG filter” that reads a message entered by the user and translates
it into C1GG message:
Sample Run:
Enter message: Hey dude, C is rilly cool
C1GG message: H3Y DUD3, C 15 R1LLY C00L!!!!!
The program should convert the message to upper-case letters, substitute
digits for certain letters (A->4, B->8, I->1, O->0, S->5), and then append 5
exclamation marks.

Anonymous said...

sir Ineed program which is to convert upper case string to lower case and vice versa using c.also i need aprogram which is arrange names in albhabetic using c with output for both programs

Unknown said...

Can anyone help me with this program?

Input positive integer n. Compute the following:

1/1!+1/2!+ .... +1/n!

Keep exactly 5 digits after the decimal point.

Anonymous said...

write three unary operator

Unknown said...

Can anyone help me with this program please?

Count the number of $ in the input. Output the result.
Sample input - as$dfkjhkjkjdhf asdfkj$lskdfj werijweirjo$wie
Sample output - 3

Unknown said...

Help Please!?

Input positive integers m and n (m<=n). Compute the sum of all prime numbers in [m,n]. [m,n] stands for all values between and including m and n.
Input - m n
Output - sum of prime numbers

Sample Input
2 3
Sample Output
5

Anonymous said...

Input positive integers m and n (m<=n). Compute the sum of all prime numbers in [m,n]. [m,n] stands for all values between and including m and n.
Input - m n
Output - sum of prime numbers

Sample Input
2 3
Sample Output
5

Unknown said...

Count the number of $ in the input. Output the result.

Input many characters

Output number of $

Sample Input as$dfkjhkjkjdhf asdfkj$lskdfj werijweirjo$wie
Sample Output 3

Anonymous said...

plz help me to write program in C "for any mXn matrix,determine whether the matrix is symmetric or skew symmetric,singular or non singular or orthogonal if nonsingular,the program should compute the inverse of the matrix.

Anonymous said...

plz help me to write a program for any matrix (mxn),determine whether the matrix is symmetric or skew-symmetric,singular or non singular or orthogonal,if non singular,the program should compute the inverse of the matrix.

Unknown said...

this website is good and easy to understand

Unknown said...

this website good and easy to understand

Anonymous said...

Ur site is really very helpful for all those who have queries. will u please help me in finding a solution to a C program to input sales of a month in 1 dim array for 35 salesmen.Calculate total sales & identify salesman who has sold the most

Anonymous said...

hi,
can u please write the program which gives the following output
1
0 1
1 0 1
0 1 0 1
1 0 1 0

Anonymous said...

OMG.................
This website is really so so useful and it perfectly matches the answer what i search ... keep on updating .......... i will suggest this website to all my friends.....

Anonymous said...

very nice site .......... thanx.. it helped me allot ...

Unknown said...

write down program in which take input roll no and different subiect marks? also calculate total,percentage and gade and praint all values?

Unknown said...

can i get the C code for binary subtraction and binary division...?

stinsha said...

#include

int main()
{
int n, sum = 0, c;

printf("Enter the number upto you want to add\n");
scanf("%d", &n);
printf("SOLUTION:-\n");

for (c = 1; c <= n; c++)
{
sum = sum + c;
if(c<11)
{
printf("%d+",c);
}
if(c==10)
{
printf("\b=%d",sum);
}
}

return 0;
}

Anonymous said...

write a program to print patterns with the help of two dimension array

Anonymous said...

Write the function strreplace(s, chr, repl_chr) which will replace each occurrences of character chr with the character repl_chr in the string s. The function returns the number of replacements. Place the source code of this function in a file named strreplace.c

kuldeepsingh007 said...

Write the function strreplace(s, chr, repl_chr) which will replace each occurrences of character chr with the character repl_chr in the string s. The function returns the number of replacements. Place the source code of this function in a file named strreplace.c

Anonymous said...

WAP that accepts nos from 0-9 along with the string to be displayed a specified no. of times use the switch case construct...
can someone plz help me with this...

Anonymous said...

wap to find sqrt of number without using sqrt function.

Anonymous said...

anyone plz help me.....
i need a c program if i give m,s,a,e,1,0 as input it will give the output as same10.......
plz help me

Unknown said...

plz give me a simple program using operator precedence and associativity

Unknown said...

plse help
write a programme to calculate length of given stream.

Unknown said...

write program to calculate length of given stream
rply

Unknown said...

write a program to calculte length og given stream

Unknown said...

write a program to calculte length og given stream

Unknown said...

write a program to calculte length og given stream

Anonymous said...

#include
int main()
{
int num,i;
printf("Enter the number,to get a table:-\n");
scanf("%d",&num);
for(i=1;i<=10;i++)
{
printf("%d x %d = %d\n",num,i,num*i);
}
}

Anonymous said...

I thnk for real table format there shud b single corectn.
In place of printf("\n%d",num*i);
I shud be printf("\n%dx%d=%d",num,i,num*i);

Anonymous said...

.Write a program that takes a sequence of lines and display each line with four letter words replaced by asterisks.

Anonymous said...

plz give me the code for finding the square root of larger number suppose 1000 or any larger number .
your collection is awesome it helps a lot.
thanks

Anonymous said...

plz give me a program to fin out the square root for larger number suppose 1000 or any larger number

Unknown said...

a text file contains a list of integers in order from lowest to highest.write a program to read and print
the text file with all duplications eliminated.
guys PLZ send me the program.....

Trixico Qais said...

Write a program that has two 2D arrays A[r][c] and B[r][1].Take input from user in array A and in Array B each row would be equal to the SUM of Corresponding row of A.
PLease give me code of that

Anonymous said...

can any one help me to write c programm to find row sum and coloumn sum of a matrix?

Unknown said...

#INCLUDE
#include
void main()
{
int a,b,c,d;
clrscr();
printf("enter the three number");
scanf("%d%d%d",&a,&b,&c);
d=a+b*c;
printf("%d",d);
gtetch();
}

HR Traders said...

Write a C program that generates a diamond? It takes input from user and
generates the diamond accordingly.

HR Traders said...

Write a C program that generates a diamond? It takes input from user and
generates the diamond accordingly.

Anonymous said...

Given two integers, multiply them.
Input:
An integer T denoting the number of testcases.
T sets of two integers A and B on separate lines.
-10^(1000)< A, B < 10^(1000)
Output:
The result of A * B.
Sample Input:
2
12345612312345632453123423442122343234
98736462562456373737387637671678628768
-5
4
Sample Output:
1218962087888515002343357130588851003810953310781392320488760173108162555712

Anonymous said...

Problem 5
Given a string, find the longest substring that is a palindrome. If there are multiple such strings print the
lexicographically smallest substring.
Input:
One string per line.
Length of the string < 10,000
Output:
The longest palindrome substring per line.
Example:
Sample Input:
aabcdcbop
bbccaa
Sample Output:
bcdcb
aa

Anonymous said...

Two sentences are said to rhyme, if their last two characters are the same.
For example, the following two sentences rhyme:
It's a lovely weather today
Time to feed the cow some hay
Your task is to find the rhyme scheme of a given stanza (A stanza is defined as a collection of lines). A
rhyme scheme is usually referred to by using letters to indicate which lines rhyme; lines designated
with the same letter all rhyme with each other. In other words, it is the pattern of end rhymes or lines.
http://en.wikipedia.org/wiki/Rhyme_scheme
Input:
An integer T denoting the number of stanzas to follow.
Each stanza ends with a #. The stanza itself will only contain the letters [a-z] and spaces. The last two
letters of each line will only be letters [a-z].
Output:
Rhyme scheme for each stanza on a separate line. The rhyme scheme will contain as many letters as
there are lines in the stanza. So, for example, if the stanze contains 12 lines, the rhyme scheme will
contain 12 letters.
You'll denote the rhyme scheme using the letters [A-Z].
Sample Input:
4
boat heat mat
soap globe
band robe
murder probe
mad cat#
sunday
monday
tuesday#
weather
laptop
books
summer vacations#
all
daughter
small
manner#
Sample Output:
ABBBA
AAA
ABCD
ABAB

Unknown said...

Please help me to display following output using nested loops
Output:
1, 4, 7, 10, 13, 16
2, 5, 8, 11, 14, 17
3, 6, 9, 12, 15, 18

Unknown said...

excellent website cquestions.com it teaches u from the starting what is c programme
awesome................ .i suggest all my frnds to use this web site for learning c programme..

Anonymous said...

Nice progs!

Rohit Bhupatbhai SONANI said...

how to print the
SUM= 2+3-6+11-18.........+UPTO N

Anonymous said...

Plz...is der ne way of getting all dese programs in c++......plz...guys cmnt.....!!!

Best Buy said...

These are common questions for programming in C and C++. Personally, I prefer C++ as a programming language. I find it easier to code in this language than in C. Anyway, I think that you have a good collection of the common questions that students are asked to answer when they are first learning the language. Thanks for sharing.

Mithiran said...

Very good for Begineers :)

Unknown said...

Can anybody tel me how to add 2 digits with out using any operator

Unknown said...

hey sir please help me following program
calculate the sum of following series upto first 20 items
s=1^4+2^4+3^4+5^4+7^4+.....................

Anonymous said...

please help me.....write a program to find the number of zeroes in the given number

Unknown said...

bu harika

Unknown said...

bu harika teşekkürler (:

Anonymous said...

Hi, can someone here give me tips at least on this question Write a recursive function printEvenOdd such that given a positive integer number as
argument, the function will first print all even digits from right to left, followed by all
odd digits from left to right. For example, the argument 12345 will cause the program
to output
4
2
1
3
5

Thanks in advance

Anonymous said...

write a c program to process students record using structures.It is required to find the first rank holder of a class,school as well as the toppers in all subjects.Assume that there are 3 branch each having 50 students.There may be more than 1 first rank and more than 1 paper for any subject

Unknown said...

write a c program to read file, counting how many duplicated characters are in the file.

Unknown said...

write a c program to read file, counting how many duplicated characters are in the file.

Unknown said...

very useful..................
thnx a lot

Unknown said...

can any one post the programme currency conversion using structure and function and user hasto input the data...

Anonymous said...

Your website is awesome. Thanks a lot. I spent all my day with this today

Anonymous said...

can anyone give c code for array implementation of booth's multiplication algorithm

please it is urgent.... thanks in advance

Anonymous said...

can anyone give c code for array implementation of booth's multiplication

Anonymous said...

can you give me example about EOF(end of file)? i want to user write number as much as he wants then terminate the program with eof and after that i want to print it out in screen like this
Enter numbers:
1 2 3 4 1 5 3 6 2 8
You entered this numbers :
1 2 3 4 1 5 3 6 2 8

srinivas reddy said...

Nice tutorial.....Please can you make zip file for all programmes

Unknown said...

i need help !!

Write an assembly program that reads the size of a right triangle and then prints it by asterisks. For example, if your program reads a size of 5, it should print:
*
**
***
****
*****

Unknown said...

i need help


Write an assembly program that takes 10 integers and finds the two largest values among input integers

Anonymous said...

Please somebody help
:1 a c program to accept a list of 10 numbers, calculate average and then display the numbers and the average
2 a c program that stores admission numbers and marks obtained by four students. the program should display on the screen

Unknown said...

i need some help:
Write a program that inserts 15 random integers from 0 to 100 in order in
a linked list. The program should calculate the sum of the elements and
the foating-point average of the elements

Unknown said...

Write a program that merges two ordered lists of integers into a single
ordered list of integers. Function merge should receive pointers to the first node of each of the lists to be merged and should return a pointer to the first node of the merged list.

JAY said...

for(i=1; i<=4; i++)
{
for(j=1; j=i; j++)
{
printf(i*i);
}
printf("\n")
}

Anonymous said...

answer dis c program to print all combination of a 4 digit number

Anonymous said...

anyone please answer to the previous question

Unknown said...

hi friends any one help me to create the c program to sort n numbers in ascending order using function

Anonymous said...

Pls help need out for loop showing
enter number:3
enter number:5
enter number:7
enter number:10
enter number:1
sum is 17

please help, thank you in advance

Unknown said...

for complex programs on macros visit cncreate.blogspot.in

Anonymous said...

2.6: Census:
Module for AcceptValues:
1. FOR loop1=1 -> n
1.1 FOR loop2=1 -> 7
1.1.1 READ Data[loop1][loop2]
2. State[25] = {all names of states}
3. Sex[2] = {‘M’,’F’}
Module for Census:
1. FOR loop1=1 -> n
1.1 IF Data[4][loop1] = State[index1]
1.2 Print State[index1]
1.3 FOR loop2= 1 -> n
1.3.1 Index2 = 0
1.3.2 IF Data[1][loop2] = Sex[index2]
1.3.3 Print Sex[loop2]
1.3.4 FOR loop3= 1 -> n
1.3.4.1 SWITCH Data[7][loop3]
1.3.4.1.1 CASE 1 : Hindu++
1.3.4.1.2 CASE 2: Muslim++
1.3.4.1.3 CASE 3: Christian++
1.3.4.1.4 CASE 9: Others++
1.3.5 Print Hindu, Muslim, Christian, Others
1.3.6 index2++
1.4 index1++

Main() function:
1. Begin
2. GOTO AcceptValues
3. GOTO Census
4. End program

Anonymous said...

tyet

Anonymous said...

#include
int factorial(int n)
{
int res=1;
int count;
for(count=1;count<=n;count++)
{
res=res*count;

}
printf("%d",res);
return res;
}

int main()
{
int f,res;
scanf("%d",&f);
res=factorial(f);
printf("%d",res);
}

Anonymous said...

its amazing.....

Wasim said...

plz add data structure programs.................. thanks

Unknown said...

Suppose we need to collect statistics of student’s marks in C programming language course. Write down a program that will read 15 students number and will print their grade distribution (i.e., how many got A grade, how many got B grade etc.). The marks of 15 students will be input to your program. Use a one dimensional array to store marks; assume all marks are integers. Also use another one dimensional array to store the statistics about grades. For example, the number of students getting A grade will be stored at index 0, the number of students getting B grade will be stored at index 1 and so on. What will be the size of that array?
The chart for grade calculation is as follows:
Marks Grade
=========== ============
90 – 100 A
80 – 89 B
70 – 79 C
60 – 69 D
< 60 F

Anonymous said...

The English Premier League (EPL) is the main sporting event in England each year. The game is
called Soccer in Australia because we play 4 different types of football; however, most of the world
simply refer to the game as Football. The Premier League has lost the source code for the program
that reports the current table of team standings. Normally, this would not cause problems because
the compiled program will continue to work until the end of the current season, whereupon it can be
replaced.
However, there is a need to report on the relative positions of the teams just including the results
from late September or October onwards on a month by month basis (or maybe two months at a
time), so clubs can know which Managers possibly need to be replaced – something that happens
regularly when a team is underperforming. So, the program needs to be re-written in its simplest
possible form to supply this information. The program will just use simple text files for input.
You will need to write a program that allows the league to feed in a simple text file of individual
match results and produce lists that are ordered alphabetically, as well as, in team performance
order.
For the Premier League, we will use shortened team names. There are 20 teams. ?
can anyone tell me source code ?
mail me - soumyajeetkhuntia@gmail.com

ASIF said...

This programming this is very very useful for any programmer. thanks thanks a lots... keep it up. Please try to show background of any programming and show more details. This is very good effort.

Unknown said...

hi please answer this program
the program can display like this
1
2 3
4 5 6
7 8 9 10
6 5 4
3 2
1

m.sumanth said...

writea c programe to search whether given element is found in array using functions

sarvjay said...

#include
#include
void main()
{
int i,j;
clrscr();
for(i=9;i>=1;i=i-2)
{
for(j=i;j<=9;j=j+2)
{
printf(" %d ",j);
}
printf("\n");
}
getch();
}

Anonymous said...

void main()
{
int n=5,a[]={3,9,12,15,18};
for(int i=0;i10)
break;
else
printf("%d",a[i]);
}
}
In the above code what will be the output?
can anyone please explain me the use of break statement in c?

Anonymous said...

it is use in ternary operator.....

JAYAMPU HEMANTH said...

this site is really awesome ........thanks for providing this site .........this site helped me a lot for my c language exam......!

Anonymous said...

program to check prime number r not?if not find the nearest prime number?if input is 7:it is prime number
if input is 9:nearest prime is 7,11

Unknown said...

Need help!!
Create a program called cashier.cpp.
Part 2. The Cashier Module
You are ready to add some of the point-of-sale functionality to your program. Currently, the cashier.cpp program displays a simulated sales slip without any sale information. Modify this program so that prior to displaying the simulated sales slip, it asks for the following data:
• The date. Expect the user to enter a date in the form MM/DD/YY. This should be entered as a string and stored in a string object variable.
• The quantity of the book being purchased: Store this number in an integer variable.
• The ISBN number of the book being purchased. The ISBN number is a string that contains numbers and hyphens. Use a string object variable to store it.
• The title of the book. Store the book title in a string object variable.
• The unit price of the book. Store this number in a floating-point variable.

Achinta said...

Thank You

Unknown said...

can any happen to know a program in c++ which check largest number in a column of a matrix

Unknown said...

Write a program to create an array for 10 numbers where the value
for 10 numbers are given by user and find out the location of given
number in array. If location was found then display “Location of
is :< answer >” else display “Element was not present”.
[NOTE: Create User define function for Find location]

Unknown said...

Write a program to create an array for 10 numbers where the value
for 10 numbers are given by user and find out the location of given
number in array. If location was found then display “Location of
is :< answer >” else display “Element was not present”.
[NOTE: Create User define function for Find location]

Anonymous said...

HOW ABOUT HEXADECIMAL TO OCATAL? PLS HELP

Unknown said...

//Hi gokila. I send you the answer, Good luck//
//Author: Michael Nesher//
#include

char *RemoveWS(char *);

int main()
{
char carr[] = "abc def ghj a aaa aa aaa";

char *p = RemoveWS(carr);

printf("%s",p);

return 1;
}

char *RemoveWS(char *ptr)
{
char *rPtr = ptr;
int i = 0,j = 0;

while(ptr[i])
{
if(ptr[i] == ' ')
for(j=i;ptr[j];j++)
ptr[j] = ptr[j+1];
else
i++;
}

return rPtr;
}

Unknown said...

#include

char *RemoveWS(char *);

int main()
{
char carr[] = "abc def ghj a aaa aa aaa";

char *p = RemoveWS(carr);

printf("%s",p);

return 1;
}

char *RemoveWS(char *ptr)
{
char *rPtr = ptr;
int i = 0,j = 0;

while(ptr[i])
{
if(ptr[i] == ' ')
for(j=i;ptr[j];j++)
ptr[j] = ptr[j+1];
else
i++;
}

return rPtr;
}

sonu said...

how we merge two sorted array into third array in sorted order

Aditya Anand said...

really a good blog... Thanks for the special effort of your

Unknown said...

hi please remove logical error in the program of finding upto n prime numbers ex.in n=7 then answer 2,3,5,7


#include
void prime(int);
void main()
{
int n;
printf("\nenter value of n");
scanf("\n%d",&n);
prime(n);
}
void prime(int n)
{
int i=2,j,f=0,k;
printf("\nprime number upto %d are\n",n);
while(i<=n)
{
f=0;
for(j=2;j<n;j++)
{
k=i%j;
if(k==0)
{
f=0;

}
else
{
f=1;
}
}

if(f==1)
{
printf("\t%d",i);

}
i++;
}
}

Anonymous said...

can you help me to solution this :Write a C++ program that computes the summation of the even numbers within the interval [1, 100] and the multiplication of the odd ones using for statement. The program must print the summation and the multiplication.

K.Karthik said...

please tell me a program which prints the following output.
1
22
333
4444
55555
please send it to uppili.karthik@GMAIL.COM

Anonymous said...

i need ac program to accept question and output the answer/defination in any subject

Bipin Karki said...

A machine is purchased which will produce earning of Rs. 20000 per year while it lasts. The machine cost Rs. 120000 and will have a salvage value of Rs. 20000 when it is condemned. If the 12 percent per annum can be earned on alternative investments what should be the minimum life of the machine to make it a more attractive investement compared to alternative investements?


wap?

«Oldest ‹Older   201 – 400 of 529   Newer› Newest»