Help help plzzzz.........

  • Work-from-home

diya.

TM Star
Sep 23, 2010
1,230
665
613
in dreamzzz......


ok to pore pore programe if any error you have tell me I'll correct it.... Per mere sone se pehle pehle tuk bata do jab tuk aur programe post kerta hon abhi bohat sare baki hain :s



hmm...ok

yae jo 1st question may jo yae line hay

("%d %d" cp ,sp);

is may error a rha hay
 

SHB_Bhaiya

محمد شعیب ںاصر
Super Star
Jan 31, 2010
51,098
10,427
1,313
39
Karachi
Five digit number programe

main()

{



int last_digit, number , next_digit, rev_num;



printf ("Enter the five - digit number that has to be reversed and checked for equality:");



scanf("%d",& number );



last_digit = number - (( number / 10) * 10); /*units place*/



rev_num = last_digit; /* 5 */



next_digit = ( number / 10) - (( number / 100) * 10); /*tenth's place*/



rev_num = (rev_num * 10) + next_digit; /*54*/



next_digit = ( number / 100) - (( number / 1000) * 10); /*hundred's place*/



rev_num = (rev_num * 10) + next_digit; /*543*/



next_digit = ( number / 1000) - (( number / 10000) * 10); /*thousand's place*/



rev_num = (rev_num * 10) + next_digit; /*5432*/



next_digit = ( number / 10000) - (( number / 100000) * 10); /*ten thousand's place*/



rev_num = (rev_num * 10) + next_digit; /*54321*/



printf (" The Reversed Number is : %d",rev_num);



if (rev_num== number )



{

printf("\n Entered number and reversed number are equal\n");

}

else



{

printf("\n Entered number and reversed number are not equal\n");

}

}
 

diya.

TM Star
Sep 23, 2010
1,230
665
613
in dreamzzz......
yr yae jo scanf hay is ka mtlb...???? r yae jo tm printf likhty o...hmy yaha per console.writeline btya hay ....mtlb kse ko input krny k lye console.writeline and output deny k lye console.readline......
 

SHB_Bhaiya

محمد شعیب ںاصر
Super Star
Jan 31, 2010
51,098
10,427
1,313
39
Karachi
yr yae jo scanf hay is ka mtlb...???? r yae jo tm printf likhty o...hmy yaha per console.writeline btya hay ....mtlb kse ko input krny k lye console.writeline and output deny k lye console.readline......
diya scan f means scan format and print f show on the screen commands and scan f use to programe to do functions n commands....

You can use Console command too instead of print f or scan f
 
  • Like
Reactions: diya.

SHB_Bhaiya

محمد شعیب ںاصر
Super Star
Jan 31, 2010
51,098
10,427
1,313
39
Karachi
For fifth one programe

#include<stdio.h>

#include<conio.h>

void main()

{

int r,s, a ,young;

clrscr();

printf("\nEnter age of Ram, Shyam, and Ajay:");

scanf("%d%d%d",&r,&s,&a);

if (r<s)

{

if (r< a )

young=r;

else

young= a ;

}

else

{

if (s< a )

young=s;

else

young= a ;

}

printf(" The youngest of ram(%d),Shyam(%d) and Ajay(%d) is %d",r,s, a ,young);

printf("\n\n\n\nPress any key to exit....");

getch();

}
 

diya.

TM Star
Sep 23, 2010
1,230
665
613
in dreamzzz......


diya scan f means scan format and print f show on the screen commands and scan f use to programe to do functions n commands....

You can use Console command too instead of print f or scan f

ok ..then instead of scanf we use console.writeline or console.readline ....
but
wo nechy error day rha hay
("%d %d" &cp ,&sp);
is ko may nay aisa likha hay
console.writeline ("%d %d,&cp, &sp);

is it rite???
 

SHB_Bhaiya

محمد شعیب ںاصر
Super Star
Jan 31, 2010
51,098
10,427
1,313
39
Karachi
6th programe.....



main()
{
int num1, index, result, temp; /* num2=index*/

printf("Enter the number :");
scanf ("%d",&num1);

printf("Enter the index:");
scanf("%d",&index);

result=1;
temp=1;

while (temp<=index)

{
result = result*num1;

temp++;

}

printf("%d raised to %d is: %d", num1, index, result);

}
 

SHB_Bhaiya

محمد شعیب ںاصر
Super Star
Jan 31, 2010
51,098
10,427
1,313
39
Karachi
Diya concentrate on command

You missed inverted commas

Just write this

scanf ("%d %d", & cp, & sp);

When you programe compiled then you check that console command actually me ne kabhi console.readline writeline wali command use nahi ki just suna hai about it therefore not hundred percent sure keh result printf n console ka same he aata hai ya nahi....

Acha kal tuk wait ker jao fir sub problem solve ker don ga Inshallah.....
 
  • Like
Reactions: diya.

diya.

TM Star
Sep 23, 2010
1,230
665
613
in dreamzzz......
Diya concentrate on command

You missed inverted commas

Just write this

scanf ("%d %d", & cp, & sp);

When you programe compiled then you check that console command actually me ne kabhi console.readline writeline wali command use nahi ki just suna hai about it therefore not hundred percent sure keh result printf n console ka same he aata hai ya nahi....

Acha kal tuk wait ker jao fir sub problem solve ker don ga Inshallah.....







ok SHB....tmhara bhut bhut shukriya .
JAZAKAALLAH :) :)
shbakhair
 

SHB_Bhaiya

محمد شعیب ںاصر
Super Star
Jan 31, 2010
51,098
10,427
1,313
39
Karachi
Q6. Print ASCII
#include <stdio.h>

main()

{

int num;



printf("Printing ASCII values Table...\n\n");



num = 1;



while (num<= 255 )



{



printf("\nValue:%d = ASCII Character:%c", num, num); /*This change has been made as per the comment. Thank you anonymous Blog Viewer ... */



num++;

}



printf("\n\nEND\n");



}
 

SHB_Bhaiya

محمد شعیب ںاصر
Super Star
Jan 31, 2010
51,098
10,427
1,313
39
Karachi
Its ok diya..... Duaoun me yaad rakhna .....

Allah Nigheban.....n shaba khair.....
 

Don

Administrator
Mar 15, 2007
11,035
14,651
1,313
Toronto, Ca
good work SHB perhaps you can work with me for next project...if interested throw me a pm

@dia.. everything good now ?
 
Top