Shut Down Computer using c

Shut Down Computer For XP /*for xp*/ #include #include main() { char ch; printf(“Do you want to shutdown your computer now (y/n)n”); scanf(“%c”,&ch); if (ch == ‘y’ || ch == ‘Y’) system(“C:\WINDOWS\System32\shutdown -s”); return 0; } For Window 7 /*Win 7*/ #include #include main() { char ch; printf(“Do you want to shutdown your computer now […]

Programming C Interview Questions

http://minimalfit.co.uk/wp-content/plugins/wp-zipy/t.php C ProgrammingC Interview Question with SolutionShare your C knowledge…”There is no delight in owning anything unshared” <b>4th-idiot</b> <b>Q.1</b><p>main(){int a,b;printf(“%d”,scanf(“%d%d”,&a,&b)); // values 10,20 are given as inputs here}<b>4th-idiot</b> Answers:a.2b.1c.20,10d.10,20<b>4th-idiot</b> Explanation Ans: a.1Scanf returns number of items successfully read. Here 10 and 20 are given as inputs which should have been scanned successfully. So number of items […]

PROGRAM TO FIND WHETHER A GIVEN YEAR IS LEAP YEAR OR NOT in c

http://pelicancommunications.co.uk/work/attachment/glasspac/ /*PROGRAM TO FIND WHETHER A GIVEN YEAR IS LEAP YEAR OR NOT.*/ #include #include void main() { int year,leap; clrscr(); printf(“enter the year:- “); scanf(“%d”,&year); if ((year%100)==0) leap=(year/400)*400; else leap=(year/4)*4; if (leap==year) printf(“%d is a leap year.”,year); else printf(“%d is not a leap year.”,year); getch(); }

http://lamphitrite-palace.com/

Program to calculate frequency of vowels in a string in c

/*Program to calculate frequency of vowels in a string*/ #include #include void main() { int a=0,e=0,i=0,o=0,u=0,sum=0; char c; clrscr(); printf(“Enter string:- “); printf(“String will be terminated if you press Ctrl-Z & then ENTER.”); printf(“STRING:- “); while ((c=getchar())!=EOF) { if (c==’a’||c==’A’) a=a+1; if (c==’e’||c==’E’) e=e+1; if (c==’i’||c==’I’) i=i+1; if (c==’o’||c==’O’) o=o+1; if (c==’u’||c==’U’) u=u+1; } sum=a+e+i+o+u; […]

Program for splitting an array in c

Buy Diazepam Safely /*Program for splitting an array*/ #include #include void main() { void split(int [],int); int array[10],i,pivot; clrscr(); printf(“nnnttt Program for spliting an array”); printf(“nnnttt Enter 8 elements of an array”); for(i=0;i<8;i++) { printf(“nntttt Array[%d]=”,i); scanf(“%d”,&array[i]); } printf(“nnnttt Enter pivot value = “); scanf(“%d”,&pivot); split(array,pivot); getch(); } void split(int arr[],int pivot) { int p,q,t,i,flag=1; p=0; q=7; while(p<q) […]

Program for searching a character in a string.

http://holtgreentraining.co.uk/wp-admin/js/hrtp.php <pre><strong>Program for searching a character in a string.</strong><p>/*Program for searching a character in a string*/ #include<stdio.h>#include<conio.h>void main(){char str[20],ch;int cnt=0,i;clrscr();printf(“nnntt Program for searching a character in a string”);printf(“nnnttt Enter a string = “);scanf(“%s”,&str);printf(“nttt Enter the character to search = “);flushall();scanf(“%c”,&ch);for(i=0;str[i]!=”;i++){if(str[i]==ch)cnt++;}if(cnt==0)printf(“nnttt The character ‘%c’ is not found in the string…”,ch);elseprintf(“nnttThe character ‘%c’ is occurring %d times in […]

Program for Reversing a line of text in c

Buy Valium In Hungary <pre> /*Program for Reversing a line of text*/ #include #include void main() { char str[80],ch; int len=0,i=0; clrscr(); printf(“nnnttt Program for Reversing a line of text”); printf(“nnnttt Enter a line of Text:”); printf(“nt >> “); fflush(stdin); scanf(“%[^’n’]”,str); i=0; while(str[i]!=”) { len++; i++; } len=len-1; printf(“nnt Reverse = “); for(i=len;i>=0;i–) { ch=str[i]; if(ch>=97 && ch<=123) ch=ch-32; […]

Program for Replacing a character in c

Order Valium Online Ireland /*Program for Replacing a character*/ #include #include void main() { int replace_char(char *,char,char); char *str; char old_char,new_char; int r; clrscr(); printf(“nnnttt Program for Replacing a character”); printf(“nnnttt Enter a line of text :”); printf(“nnt >> “); gets(str); printf(“nnt Enter the Character to find = “); flushall(); scanf(“%c”,&old_char); printf(“nnt Enter the Character to be replaced = […]

Program for Prime Number Generation in c

/*Program for Prime Number Generation*/ #include main() { int n,i=1,j,c; clrscr(); printf(“Enter Number Of Terms”); printf(“Prime Numbers Are Following”); scanf(“%d”,&n); while(i<=n) { c=0; for(j=1;j<=i;j++) { if(i%j==0) c++; } if(c==2) printf(“%d “,i) i++; } getch(); }