- Strength to Increase Rep
- +0
- Strength to Decrease Rep
- -0
- Upvotes Received
- 0
- Posts with Upvotes
- 0
- Upvoting Members
- 0
- Downvotes Received
- 2
- Posts with Downvotes
- 2
- Downvoting Members
- 2
16 Posted Topics
The main difference between while and for loop is "for" can execute without condition but when we execute while function the condition is mandotary........ Ex: [CODE]void main() { int i; for(;;) //Means an infinate loop { if(i<10) break; i++; } printf(" %d ",i); }[/CODE] -----No error executes succesfully---- Ex: [CODE]void …
[CODE] #include<stdio.h> #include<conio.h> #include<stdlib.h> int main() { int a,i; printf("\n Enter a number : "); scanf("%d",&a); for(i=2; i<=a/2; i++) { if(a%i==0) { printf("\n Not a prime number"); getch(); exit(0); } } int a,i; printf("\n Enter a number : "); scanf("%d",&a); for(i=2; i<=a/2; i++) { if(a%i==0) { printf("\n Not a prime …
"The hidden treasure of c" by Rajiv Dhaneskar
[CODE] #include<stdio.h> #include<conio.h> int main() { int n,i,rev=0,num; printf("\n Enter a number : "); scanf("%d",&n); num=n; while(n) { rev=rev*10+n%10; n/=10; } if(num==rev) printf("\n Is Armstrong"); else printf("\n Not an Armstrong"); } [/CODE]
In line number 17 and 21 %c is replaced as %s......
For this problem you refer the book let us c...... I think the chapter number is 8 or 9 is about Keyboard
In line number 31 replace the code as while(ch!='\n');
First of all you know about the fibonacci series........ After that try to implement the code for that......
In line number : 31 just modify your code as while(ch!='\n');
[CODE]#include<stdio.h> #include<conio.h> int main() { int a[10]; int i; int esum=0,osum=0; // One for even sum and one for odd sum printf("\n Enter 10 numbers : "); for(i=0;i<10;i++) scanf("%d",&a[i]); for(i=0;i<10;i++) { if(a[i]%2==0) esum=esum+a[i]; else osum=osum+a[i]; } printf("\n Even numbers sum is : %d",esum); printf("\n Odd numbers sum is : %d\n",osum); …
If ur the beginner of programming language the come to anantapur and join to madhavi infotech software training........ It's very good and useful to u.......
the parameters taking of printf function is from right to left..... So in the given problem the function executes as follows.... b=1; printf("\n %d %d %d",b=15, b>9, b<9); So first it executes the condition b<9 but here b=1 next it executes the condition b>9. Here also b=1 and the last …
using the functions textbackground(int) and setbkcolor(int) .. textbackground(int) prototype is in the header file conio.h and setbkcolor(int) prototype is in the header file graphics.h and
[CODE]#include<stdio.h> #include<conio.h> #include<string.h> #include<ctype.h> #include<stdlib.h> int main() { char org[50],r[50],m[50],a; int i,j,c=0,length=0,h=0,g=0,z; char token [3] [20] = { "void", "main", "int"}; printf("\nenter a line:"); gets(org); for(i=0; org[i]!='\0'; i++) length++; while(g!=length) { for(g; g<length; g++) { if(org[g]==' ' || org[g]=='\n' || org[g]=='\t') { g++; break; } m[c++]=org[g]; } m[c]='\0'; for(h=0; h<3; …
if u knw about the concept of buffer then easily u can this problem urself........
The End.
ashok1514