C programming forums

C lovers




This forum is for us. 

67 comments:

Anonymous said...

what is the source code for a program that can be executed once and the file(the whole program) which have this code have to deleted from directory automatically?

Amlan said...

how can i change the source code file name by compiling it?

Amlan said...

what is the return type of Printf function??with Explanation????

Anonymous said...

recently i had written a c exam in which i got the following question :

“Hello World” can be written without semicolon

a) C89
b) C99
c) Cannot be done

i know this one way i which "hello world can be printed" by

if (prinf("hello world")
but i am not sure whther it will work in c89 and c99 also, i jus tried in turbo c and it works. in this case what should be my answer for the above question.

vaibhav said...

return type of printf() is int and it return number of character it print

Anonymous said...

what wil be the outputof following code
main(){
char p[]="%d\n";
p[1]='c';
printf(p,65);
}

Anonymous said...

Output of above code : A

Anonymous said...

2. Write a function that, given two dimensions entered from the keyboard, it should compute the area and perimeter/circumference, of three polygons – Square, Rectangle, and Circle.

Anonymous said...

Program to find out the following:

1^2/1!+2^2/2!+3^2/3!+4^2/4!+……………………………..……. n^2/n! terms.

please anyone help...

Anonymous said...

What would be the program for this one?

1.2/3+2.3/4+3.4/5+…………………………………..n terms.

manju said...

x=0;
while(x<10)
{printf("%d",x);
x++;
}
change it into do while loop

Sagrika said...

In do while loop

x=0;
do{
if(x<10){
prinf("%d",x);
x++;
}
}
while(x<10);

Anonymous said...

WAP TO CODE THE FOLOWNG OUTPUT:
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
1 2 3 4 5 6
1 2 3 4 5 6 7 8

SONU said...

#include
#include

struct xyz
{
int x;
char a[2];
}e;

void main()
{
e.x=512;
printf("%d",e.x);
printf("%d",e.a[0]);
printf("%d",e.a[1]);
getch();
}


what will be the output and why....?????

Anonymous said...

WAP TO CODE THE FOLOWNG OUTPUT:
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
1 2 3 4 5 6
1 2 3 4 5 6 7 8


Solution:-

int i,j,k=1;

for(i=1;i<=8;i++)
{
for(j=1;j<=i;j++,k++)
printf("%d",k);
printf("\n");
}

Anonymous said...

Can you help me solve these two problems:

I) Consider an array A of n integers (n constant).
Write a program to:
1- fill an array B (of at most n integers) by the number of elements in each ascending sequence in A (see the example below).
2- fill an array C (of at most n/2 integers) by the number of occurrences of each value in B. Note that each value in B is to be considered once.
3-display the total number of ascending sequences and the total number of sequences of different sizes

II) Consider an array T of n integers (n constant)
Write a program to sort the even elements and sort the odd elements of T by ascending order, depending on the min of T : if the min is even, even elements must be sorted first, otherwise, odd elements will start the aray.

tank said...

wap a program that accept a positive integer N(1<=N<=15).

input=5
output:
1 * * * * * * * * * 1
1 4 * * * * * * * 1 2
1 4 9 * * * * * 3 5 8
1 4 9 6 * * * 3 1 4 5
1 4 9 6 5 * 9 4 3 7 0

Anonymous said...

) Consider an array A of n integers (n constant).
Write a program to:
1- fill an array B (of at most n integers) by the number of elements in each ascending sequence in A (see the example below).
2- fill an array C (of at most n/2 integers) by the number of occurrences of each value in B. Note that each value in B is to be considered once.
3-display the total number of ascending sequences and the total number of sequences of different sizes

II) Consider an array T of n integers (n constant)
Write a program to sort the even elements and sort the odd elements of T by ascending order, depending on the min of T : if the min is even, even elements must be sorted first, otherwise, odd elements will start the aray.

Arthas said...

I have a text file: sample.txt, which is constantly being updated with data. I need to read this file constantly and update an excel spreadsheet with the data in this text file. Can anyone please help me with the program to do so?

dip said...

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

amit said...

hw to copy and paste a function from one file to another file??

i have tried using cretng header files .h eg. #include "genrte.h"................ but i think thrgh this come prblm is cmng...plz help

Anonymous said...

what is storage class,what is the use of it,pls
explain with example

Anonymous said...

In representation of floating point numbers when we take LSB 1(although when it is 0 )?

GAURAV said...

What is structure padding ?explain with example

Anonymous said...

can we print any message in 'c' without using semicolon?

Ritesh kumar said...

yes we can write the message without using any semicolon:


Solution: 1
void main(){
if(printf("Hello world")){
}
}

Solution: 2

void main(){
while(!printf("Hello world")){
}
}

Solution: 3

void main(){
switch(printf("Hello world")){
}
}

Anonymous said...

#include #include void quiz(int w); main() { int x= 5; clrscr(); quiz(5); } void quiz(int w) { if(w>1) { quiz(w/2); quiz(w/2); } printf("*"); }

Anonymous said...

please explain how it works
void quiz(int w); main() { int x= 5; clrscr(); quiz(5); } void quiz(int w) { if(w>1) { quiz(w/2); quiz(w/2); } printf("*"); }

chirayu manohar said...

output
1
22
333
4444
55555

Anonymous said...

write a c program to simulate a rational data type in c

Anonymous said...

write a c program to calculate area of perimeter of a right angled triangle witha,b,c where cis the hypothneus use formula c square =a squar+bsquare and area=0.5*(a*b)

Anonymous said...

main(){
char p[]="%d\n";
p[1]='c';
printf(p,65);
}
Ans is:A

Anonymous said...

void main()
{
int arr[10]={1,2,3,4,1,2,3,5,6,7};
int asize=sizeof(arr)/sizeof(arr[0]);
int i,j;
clrscr();
for(i=0;i<asize;i++){
for(j=(i+1);j<asize;j++)
{
if(arr[j]-arr[j+1]==0)
{
printf("\nThe Duplicate Array is:%d",arr[j]);
}
}
}
getch();
}

Anonymous said...

function()
{
printf(" Hello World");
}
How to define this function to get the output "Hello world" without calling the function in main()

vaibhav said...

but how to create an algorithm for second largest number of a list of numbers given by the user.

Anonymous said...

Does Sequence In matter In Structures?

Ex;

Struct exp{

void *data;
int num;
}

and

struct exp{

int num;

void *data;
}

Anonymous said...

Hi guys whats the C code for checking whether a user has entered a number twice and display an error message
thnx

Anonymous said...

how to write a C++ program showing the highest integer among three given integers using IF condition 6 times?

Anonymous said...

hi,
1.wap to print a semicolon without using a semicolon anywhere in the code.
2.wap compare two strings without using strcmp()
3.wap concatenate two strings without using strcat()
4.wap delete a specified line from a text file
5.wap replace a specified line ina text file
6.wap to find the number of lines in a testfile

Ritesh kumar said...

Go through following links:

http://cquestionbank.blogspot.com/2011/09/c-program-to-print-hello-world-without.html
http://cquestionbank.blogspot.com/2011/09/how-to-compare-two-strings-in-c-without.html
http://cquestionbank.blogspot.com/2011/09/string-concatenation-in-c-without-using.html

Anonymous said...

write a program to capture the prime numbers between 0 and 40

kaveri said...

nice questions

Frnd forever said...

i want to get even numbers by addition or subtraction in c programmimn

Frnd forever said...

please tell me
my e id singhaniyanrajesh2@gmail.com

Pankaj Yadav said...

hi
pls explain how it work
a=5,b=10;
a=a^b;
b=a^b;
a=b^a;
printf("%d%d",a,b);

Anonymous said...

Can anyone help me write a source code that could print odd and even numbers between 1 and 50,odd in word and even in excel immediately because i am handing in the work tomorrow morning

Anonymous said...

#include
#include

int main()
{
int i,j;

for(i=0;i<8;i++)
{
for(j=0;j<i;j++)
{
printf("%d",j);
}
printf("\n");
}
getch();
return 0;
}

Anonymous said...

#include
#include

int main()
{
int i,j;
for(i=0;i<=5;i++)
{
for(j=0;j<i;j++)
{
printf("%d",i);
}
printf("\n");
}
getch();
return 0;
}

Anonymous said...

Given a number N, product(N) is the product of the digits of N. We can then form a sequence N, product(N), product(product(N))...
For example, using 99, we get the sequence 99, 9*9 = 81, 8*1 = 8.
You are expected to complete the function, getSingleDigitProduct, which takes a single argument. The argument passed to the function is an integer N. Your function is expected to return after how many steps a single digit number occurs in this sequence.
please help me

c programming tutorial said...

Good information. needs to be arranged in a better way.

Anonymous said...

sir, please upload the c programme for tic tac toe game...

Anonymous said...

this is another way to print "hello world "

while(!printf("hello world")){}

Arcee Molano said...

Could you tell me what would be the code for this output
10 1 9 2 8 3 7 4 6 5 5 6 4 7 3 8 2 9 1 10

Jimesh Solanki said...

Yes....it's Workling........

reynaldo tan said...

write a program which produce the given sequence number using the 3 looping statement
output 5,1,4,2,3,3,2,4,1,5,


help me plzzzzz :(

reynaldo tan said...

im waiting ^_^

Anonymous said...

How to print using recursion the following
*
**
***
****
*****
? Thanks

Anonymous said...

switch(printf("hello world")){}

Anonymous said...

p[1] = c overwrite the second element of array P by c. so array p becomes %c.
printf(p,65) it prints the ASCII value of 65
so output is A

Anonymous said...

if(printf("hai")){ }

san said...

Program to convert given number to words....(upto 10 digits)
for example...
input :12345
output :twelve thousand three hundred forty five...

Priti Ravindran said...

How to write the algorithm for switch statement in C?

Kamlesh Mali said...

yes..
We create another copy of file when compile the source code and change old file name.

oumamine said...
This comment has been removed by the author.
oumamine said...
This comment has been removed by the author.
oumamine said...

how to write c program multiply octal and hexadecimal numbres

someone said...

c program to print ur address