Question about Computers & Internet

1 Answer

Char a; main() {clrscr(); printf(" Enter Name:"); scanf("%s",&a); if(a==Moulin) printf(" Ok"); else printf(" K,O"); getche(); } What is the problem in this coding..??

Posted by on

Ad

1 Answer

  • Level 1:

    An expert who has achieved level 1.

    Hot-Shot:

    An expert who has answered 20 questions.

    Corporal:

    An expert that hasĀ over 10 points.

    Mayor:

    An expert whose answer gotĀ voted for 2 times.

  • Contributor
  • 37 Answers

Printf (%d, "...");

%d, %f are not used

Posted on Nov 13, 2009

Ad

1 Suggested Answer

6ya6ya
  • 2 Answers

SOURCE: I have freestanding Series 8 dishwasher. Lately during the filling cycle water hammer is occurring. How can this be resolved

Hi there,
Save hours of searching online or wasting money on unnecessary repairs by talking to a 6YA Expert who can help you resolve this issue over the phone in a minute or two.

Best thing about this new service is that you are never placed on hold and get to talk to real repairmen in the US.

Here's a link to this great service

Good luck!

Posted on Jan 02, 2017

Ad

Add Your Answer

Uploading: 0%

my-video-file.mp4

Complete. Click "Add" to insert your video. Add

×

Loading...
Loading...

Related Questions:

1 Answer

Hello... i need a program in c...... a calendar where you can save on a specific date a reminder...


#include <stdio.h>
#include <conio.h>
#include <math.h>
#include <iostream.h>
#include <fstream.h>


int getdaycode(int year)
{
return(year+(year-1)/4-(year-1)/100+(year-1)/400)%7;
}

int bool getleapcode(int year)
{
return year%4==0&&year%100!=0''year%400==0;
}


main()
{
clrscr();
int choice,month,days,day,daycode;
printf("\t\t\tSCHEDULER-CALENDAR PROGRAM\n\n\n");
printf("Please choosefrom the Menu:\n");
printf("\t1- Calendar Dislplay\n");
printf("\t2- Schedule Editor\n");
printf("\nChoice: ");
scanf("%d",&choice);

if(choice==1)
{
clrscr();
int year;
printf("\tCalendar Display\n\n");
printf("Type the YEAR to be Displayed: ");
scanf("%d",&year);
printf("\nYear = %d",year);

bool leapcode;

daycode=getdaycode(year);
leapcode=getleapcode(year);


for(month=1;month<=12;month++)
{
switch(month)
{
case 1:
{
printf("\nJanuary");
days=31;
}
break;

case 2:
{
printf("\n\nFebruary");
if(leapcode)
{
days=29;
}
else
{
days=28;
}
}
break;

case 3:
{
printf("\n\nMarch");
days=31;
}
break;

case 4:
{
printf("\n\nApril");
days=30;
}
break;

case 5:
{
printf("\n\nMay");
days=31;
}
break;

case 6:
{
printf("\n\nJune");
days=30;
}
break;

case 7:
{
printf("\n\nJuly");
days=31;
}
break;

case 8:
{
printf("\n\nAugust");
days=30;
}
break;

case 9:
{
printf("\n\nSeptember");
days=31;
}
break;

case 10:
{
printf("\n\nOctober");
days=30;
}
break;

case 11:
{
printf("\n\nNovember");
days=31;
}
break;

case 12:
{
printf("\n\nDecember");
days=30;
}
break;
}


printf("\n\nSun Mon Tue Wed Thu Fri Sat\n");

for(day=1;day<=daycode*5;day++)
{
printf(" ");
}
for(day=1;day<=days;day++)
{
printf(" %d ",day);

if((day+daycode)%7>0)
{
printf(" ");
}
daycode=(daycode+days)%7;
}

}



}
if(choice==2)
{
printf("Schedule Editor\n\n");
FILE *fptr1;
char filename1[]="sched.txt";
int reval=SUCCESS;

if((fptr1==fopen(filename1,"w"))
{
printf("File cannot be opened\n");
reval=FAIL;
}
else
{
CharReadWrite(fptr1);
fclose(fptr1);
}


int

getch();
return 0;
}

Sep 07, 2011 | Computers & Internet

2 Answers

How to remove linker error in Tc C++ 3.0 in graphics.h header file and iomanip.h and msoftcon.h and windows.h


#include<stdio.h>
#include<conio.h>
#include<string.h>
#include<stdlib.h>
#include<ctype.h>
struct student
{char name[20];
int rollno;
int mark;
};
void main()
{
int ch,f,roll,i,j,l;
char name[20];
struct student k,t,d[50];
FILE *fp,*temp;
clrscr();
fp=fopen("stud.c","wb");
fclose(fp);
while(1)
{printf("\n=========================\n");
printf("\n\n1.Insert\n2.Display\n3.Search\n4.Delete\n5.Sort\n6.Update\n7.Exit");
scanf("%d",&ch);
printf("\n==========================\n");
switch(ch)
{
case 1:
{
printf("\n Enter name");
scanf("%s",k.name);
printf("\n Roll no:");
scanf("%d",&k.rollno);
printf("\n Mark");
sanf("%d",&k.mark);
fp=fopen("stud.c","a+b");
fwrite(&k,sizef(k),l,fp);
fclose(fp);
break;}
case 2:
{
fp=fopen("stud.c","rb");
while(fread(&k,sizeof(k),l,fp)!=0)
printf("\n name:%s \t Rollno: %d \t Mark:%d",k.name,k.rollno,k.mark);
fclose(fp);
break;
}
case 3:
{f=0;
fp=fopen("stud.c","rb");
printf("\nEnter the rollnumber to be searched :");
scanf("%d",&roll);
while(fread(&k,sizeof(k),l,fp)!=0)
{ if(k.rollno==roll)
{
f=1;
printf("\n Name:%s \t Rollno:%d\t Mark:%d,k.Name,k.rollno,k.mark");
}
}
if(f==0)
printf("searched item does not exit");
fclose(fp);
break;
case 4:
f=0;
printf("enter the roll no for deleting the record:");
scanf("%d",&roll);
fp=fopen("stud.c","rb");
temp=fopen("temp.c","wb");
while(fread(&k,sizeof(k),l,fp)!=0)
{
if(k.rollno==roll)
f=1;
else
fwrite(&k,sizeof(k),l,temp);
}
fcloseall();
if(f==1)
{
temp=fopen("temp.c","rb");
fp=fopen("stud","wb");
while(fread(&k,sizeof(k),l,temp)!=0)
fwrite(&k,sizeof(k),l,fp);
printf("record deleted");
}
else
printf("roll no not found");
fclose(fp);
fclose(temp);
break;
}
case 5:
{
fp=fopen("stud.c","rb");
i=0;
while(fread(&d[i],sizeof(k),i,fp)!=0)
i++;
fclose(fp);
for(j=0;j<i-1;j++)
{
for(l=j;l<i;l++)
{
if(d[j].rollno>d[l].rollno)
{
t=d[j];
d[j]=d[l];
d[l]=t;
}
}
}
fp=fopen("stud.c","wb");
for(l=0;l<i;l++)
fwrite(&d[l],sizeof(k),l,fp);
fclose(fp);
printf("\nsuccessfully sorted");
break;
}
case 6:
{
f=0;
printf("enter roll number to update:");
scanf("%d",&roll);
fp=fopen("stud.c","rb");
temp=fopen("temp.c","wb");
while(fread(&k,sizeof(k),l,fp)!=0)
{
if(roll==k.rollno)
{
printf("enter the new record name,mark\n");
scanf("%s%d",k.name,&k.mark);
f=1;
}
else
fwrite(&k,sizeof(k),l,temp);
}
fcloseall();
fp=fopen("stud.c","wb");
temp=fopen("temp.c","rb");
while(fread(&k,sizeof(k),l,temp)!=0)
fwrite(&k,sizeof(k),l,fp);
if(f==0)
printf("roll no is not present");
fcloseall();
break;
}
case 7:
exit(1);
break;
}
}
}

Nov 25, 2010 | Borland Turbo C++ 3.0 Full Version...

2 Answers

Write a program that accept a number and output its equivalent in words.


Below is the program written in Turbo C.

#include<stdio.h>
void pw(long,char[]);
char *one[]={" "," one"," two"," three"," four"," five"," six"," seven","
eight"," Nine"," ten"," eleven"," twelve"," thirteen"," fourteen","
fifteen"," sixteen"," seventeen"," eighteen"," nineteen"};
char *ten[]={" "," "," twenty"," thirty"," forty"," fifty"," sixty","
seventy"," eighty"," ninety"};

void main()
{
long n;
clrscr();
printf("
Enter any 9 digit no: ");
scanf("%9ld",&n);
if(n<=0)
printf("Enter numbers greater than 0");
else
{
pw((n/10000000),"crore");
pw(((n/100000)%100),"lakh");
pw(((n/1000)%100),"thousand");
pw(((n/100)%10),"hundred");
pw((n%100)," ");
}
getch();
}

void pw(long n,char ch[])
{
(n>19)?printf("%s %s ",ten[n/10],one[n%10]):printf("%s ",one[n]);
if(n)printf("%s ",ch);
}

Aug 06, 2010 | Borland Turbo C++ Suite 1.0...

1 Answer

C# code wite a program to accept a number from the user and display all the prime numbers fro zero up to the numbers entered by user?


#include<stdio.h>
#include<conio.h>
void main()
{
int n,i,rem,prime,primchk=1,chk;
clrscr();
printf("\nEnter the limit\n");
scanf("%d",&n);
printf("\n\n\nThe prime numbers are\n");
printf("\n2\t3\t");
for(primchk=1;primchk<=n;primchk++)
{
for(i=2;i<primchk;i++)
{
if(primchk%i==0)
{
chk=1;
chk=0;
break;
}
if(i==primchk-1)
{
if(chk==0)
{
printf("%d\t",primchk);
chk=0;
}
}
}
}
getch();
}

May 20, 2009 | Computers & Internet

1 Answer

A c program to implement transportation problem


#include<stdio.h>
#include<conio.h>

main()
{
int flag=0,flag1=0;
int s[10],d[10],sn,eop=1,dm,a[10][10];
int i,j,sum=0,min,x[10][10],k,fa,fb;

clrscr();
/* Getting The Input For the Problem*/

printf("Enter the number of Supply
");
scanf("%d",&sn);
printf("Enter the number of Demand
");
scanf("%d",&dm);
printf("Enter the Supply Values
");
for(i=0;i<sn;i++)
scanf("%d",&s[i]);
printf("Enter the Demand Values
");
for(j=0;j<sn;j++)
scanf("%d",&d[j]);
printf("Enter the elements of the array
");
for(i=0;i<sn;i++)
{
for(j=0;j<dm;j++)
{
scanf("%d",&a[i][j]);
}
}
/* Calculation For the Transportation */
i=0;j=0;
for(i=0,j=0;i<sn,j<dm;)
{
if(s[i]<d[j]) // Check supply less than demand
{
x[i][j]=a[i][j]*s[i]; // Calculate amount * supply
d[j]=d[j]-s[i]; // Calculate demand - supply
i++; // Increment i for the deletion of the row
or
column
}
else if(s[i]>=d[j]) //Check the supply greater than equal to
demand
{
x[i][j]=a[i][j]*d[j]; // Calculate amount * demand
s[i]=s[i]-d[j]; // Calculate supply - demand
j++; // Increment j for the deletion of the row
or
column
}

}
/* The Cost Matrix is Estimated here */
printf("Given Cost Matrix is :
");
for(fa=0;fa<sn;fa++)
{
for(fb=0;fb<dm;fb++)
{
printf("%d ",a[fa][fb]);
}
printf("
");
}
/* The Allocated Cost Matrix is */

printf("Allocated Cost Matrix is
");
for(fa=0;fa<sn;fa++)
{
for(fb=0;fb<dm;fb++)
{
printf("%d ",x[fa][fb]);
sum=sum+x[fa][fb];
}
printf("
");
}
/* Transportation Cost Estimated and Sum is Printed*/
printf("The Transportation cost:%d
",sum);
getch();
}

Apr 08, 2009 | Computers & Internet

5 Answers

Source code for stack using arrays in c++


stack in c using arrays
/* Program of stack using array*/
#include

Dec 05, 2008 | Computers & Internet

1 Answer

C code


try this Code

  1. #include<stdio.h>
  2. #include<conio.h>
  3. #include<alloc.h>
  4. void main()
  5. {
  6. int i, j,n,*p,check=1, blank, memspace, mem=0, rowdiff=1;
  7. printf("Enter the no. of rows to be printed :");
  8. scanf("%d",&n);
  9. blank=n-1;
  10. memspace=((n*(n+1))/2);
  11. p=(int*)malloc(sizeof(int)* memspace);
  12. for(i=0;i<n;i++)
  13. {
  14. printf("\n");
  15. for(j=0;j<blank;j++)
  16. printf(" ");
  17. for(j=0;j<check;j++)
  18. {
  19. if(j==0 || j==(check-1))
  20. p[mem]=1;
  21. else
  22. p[mem]=p[mem-rowdiff] + p[mem-rowdiff+1];
  23. printf("%d ",p[mem]);
  24. mem++;
  25. }
  26. for(j=0;j<blank;j++)
  27. printf(" ");
  28. blank--;
  29. check++;
  30. rowdiff++;
  31. }
  32. getch();
  33. }
--------------------------------------------------------------------------------------------------------------------------------------------------
#include<stdio.h>
void main()
{
int num,x,y,a[50][50];
clrscr();
fflush(stdin);

printf("Enter the number of rows: ");
scanf("%d",&num);

printf("\n\t\tPascal's Triangle of Order %d\n\n",num);

for(x=0;x<num;x++)
{
for(y=0;y<=x;y++)
{
if(x==y || y==0)
a[x][y]=1;
else
a[x][y]=a[x-1][y-1]+a[x-1][y];
printf("%4d",a[x][y]);
}
printf("\n\n");
}

getch();
}

Sep 20, 2008 | Computers & Internet

1 Answer

Need code


Try the Following Five Programs

1) Program for Prime Number Generation

#include <stdio.h>
main()
{
int n,i=1,j,c;
clrscr();
printf("Enter Number Of Terms
");
printf("Prime Numbers Are Follwing
");
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();
}
--------------------------------------------------------------------------------------------------------------------------------------------------

2)Program for finding the prime numbers

#include <stdio.h>
#include <conio.h>
void main()
{
int n,m,k,i,max;
char c;
clrscr();
repeat: max=0;
k=2;
n=1;
printf("You want prime numbers upto:- ");
scanf("%d",&max);
printf("

");
for (i=1;i<=max;i++)
{
again: m=(n/k)*k;
if (m!=n)
k=k+1;
else
goto try1;
if (k < n/2)
goto again;
else
printf("%d",n);
printf(" ");
try1: n=n+1;
k=2;
}
fflush(stdin);
printf ("

Do you want to continue?(y/n):- ");
scanf("%c",&c);
if (c=='y')
goto repeat;
getch();

}
---------------------------------------------------------------------------------------------------------------------------------------------------

3)
  1. #include <stdio.h>
  2. int main(void) {
  3. int n,
  4. lcv,
  5. flag; /* flag initially is 1 and becomes 0 if we determine that n
  6. is not a prime */
  7. printf("Enter value of N > ");
  8. scanf("%d", &n);
  9. for (lcv=2, flag=1; lcv <= (n / 2); lcv++) {
  10. if ((n % lcv) == 0) {
  11. if (flag)
  12. printf("The non-trivial factors of %d are: \n", n);
  13. flag = 0;
  14. printf("\t%d\n", lcv);
  15. }
  16. }
  17. if (flag)
  18. printf("%d is prime\n", n);
  19. }
---------------------------------------------------------------------------------------------------------------------------------------------------

4)

#include<stdio.h>

#include<conio.h>

void main()

{

int n,i,c=0;

clrscr();

printf("enter the number:");

scanf("%d",&n);

for(i=1;i<=n;i++)

{

if(n%i==0)

{

c=c+1;

}

}

if(c==2)

printf("number is prime");

else

printf("number is not prime");

getch();

}
-------------------------------------------------------------------------

5)
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c;
clrscr();
printf("enter the number:");
scanf("%d",&a);
for(b=2;b<a/2;b++)
{
if(n%i==0)
{
printf("\n Its not a Prime number");
c=1;
break;
}
if(flag==0)
printf("\n Its a Prime Number");
getch();
}
}


Sep 02, 2008 | Computers & Internet

3 Answers

C programming coading


1
2 2
3 3 3
4 4 4 4
5 5 5 5 5

Apr 30, 2008 | Computers & Internet

Not finding what you are looking for?
Computers & Internet Logo

Related Topics:

32 people viewed this question

Ask a Question

Usually answered in minutes!

Top Computers & Internet Experts

Les Dickinson
Les Dickinson

Level 3 Expert

18424 Answers

Doctor PC
Doctor PC

Level 3 Expert

7733 Answers

David Payne
David Payne

Level 3 Expert

14162 Answers

Are you a Computer and Internet Expert? Answer questions, earn points and help others

Answer questions

Manuals & User Guides

Loading...