This Blog Is Created By Tushar khoje And will try to solve computer related Problems, and will help to teach C programmings and other computer related things
Friday, December 10, 2010
Thursday, December 9, 2010
use of a constant
//This program demonstrates the use of a constant
#include
int main()
{
const int constantNumber = 100; //Declaration of a constant.
It must be initialized immediately, else it picks up a garbage value.
//constantNumber = 30; Will generate an error. Cannot change the value of a constant
printf("The value is %d", constantNumber);
return 0;
}
#include
int main()
{
const int constantNumber = 100; //Declaration of a constant.
It must be initialized immediately, else it picks up a garbage value.
//constantNumber = 30; Will generate an error. Cannot change the value of a constant
printf("The value is %d", constantNumber);
return 0;
}
use of arithmetic operators and its precedense
//This program demonstrates the use of arithmetic operators and its precedense
#include
int main()
{
int value1, value2, value3;
clear();
value1 = 10;
value2 = 20;
value3 = value1 + value2 * 2;
printf("\nvalue1=%d, value2=%d, value1+value2*2=%d", value1, value2, value3);
value3 = (value1 + value2) * 2;
printf("\nvalue1=%d, value2=%d, (value1=value2)*2=%d", value1, value2, value3);
value1 = 20;
value2 = 10;
value3 = ((value1/value2)*value2)+(value1%value2);
printf("\nvalue1=%d, value2=%d, ((value1/value2)*value2)+(value1%value2)=%d", value1, value2, value3);
return 0;
}
#include
int main()
{
int value1, value2, value3;
clear();
value1 = 10;
value2 = 20;
value3 = value1 + value2 * 2;
printf("\nvalue1=%d, value2=%d, value1+value2*2=%d", value1, value2, value3);
value3 = (value1 + value2) * 2;
printf("\nvalue1=%d, value2=%d, (value1=value2)*2=%d", value1, value2, value3);
value1 = 20;
value2 = 10;
value3 = ((value1/value2)*value2)+(value1%value2);
printf("\nvalue1=%d, value2=%d, ((value1/value2)*value2)+(value1%value2)=%d", value1, value2, value3);
return 0;
}
Some C Refrence Books
main Book is Lets C By Yashwant Kanitkar obviously but here are some other Reference Books
References
1. ‘C’ Odyssey
By: Vijay Mukhi
2. C under UNIX
By: Y.P. Kanetkar
3. Thinking in C
By: Bruce Eckel
4. Let Us C
By: Y.P. Kanetkar
5. Programming in C
By: Dennis Ritchie and Kernighan
Thanks,
Tushar Khoje
References
1. ‘C’ Odyssey
By: Vijay Mukhi
2. C under UNIX
By: Y.P. Kanetkar
3. Thinking in C
By: Bruce Eckel
4. Let Us C
By: Y.P. Kanetkar
5. Programming in C
By: Dennis Ritchie and Kernighan
Thanks,
Tushar Khoje
Weitage
C Programming Topic Wise Weightage
Topics Percentage Weightage Marks
Arrays 12 to 14 % 05 to 07
Structures 12 to 14 % 05 to 07
Pointers 12 to 16 % 06 to 08
Functions 10 to 12 % 04 to 06
Preprocessors 02 to 06 % 01 to 03
File handling 18 to 22 % 09 to 11
Command line arguments 02 to 06 % 01 to 03
Standard Coding Practices 10% 05
Total marks 100% 50
Topics Percentage Weightage Marks
Arrays 12 to 14 % 05 to 07
Structures 12 to 14 % 05 to 07
Pointers 12 to 16 % 06 to 08
Functions 10 to 12 % 04 to 06
Preprocessors 02 to 06 % 01 to 03
File handling 18 to 22 % 09 to 11
Command line arguments 02 to 06 % 01 to 03
Standard Coding Practices 10% 05
Total marks 100% 50
Reverse of a String using Recursion
/* C Program to print Reverse of String Using Recursion */
#include
int main()
{
int num,rev;
printf("\nEnter a number :");
scanf("%d",&num);
rev=reverse(num);
printf("\nAfter reverse the no is :%d",rev);
return 0;
}
int sum=0,r;
reverse(int num)
{
if(num)
{
r=num%10;
sum=sum*10+r;
reverse(num/10);
}
else
return sum;
return sum;
}
#include
int main()
{
int num,rev;
printf("\nEnter a number :");
scanf("%d",&num);
rev=reverse(num);
printf("\nAfter reverse the no is :%d",rev);
return 0;
}
int sum=0,r;
reverse(int num)
{
if(num)
{
r=num%10;
sum=sum*10+r;
reverse(num/10);
}
else
return sum;
return sum;
}
To Print Prime Factors of a number
Subscribe to:
Posts (Atom)