Professional Documents
Culture Documents
Assign 1
Assign 1
5
(a) printf("%-10d\n", 10000);
The statement is correct.
1000
i)char s[ 10 ];
scanf( "%c", s[ 7 ] );
Correct :char s[10];
printf( "%c\n", s[7] );
(9.7):
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
int x,y;
printf("Enter two same type number: ");
scanf("%i%d",&x,&y);
printf("%d %d\n",x,y);
return 0;
}
Enter two same type number: 10:10
10 10
Enter two same type number: -10:-10
-10 -10
Enter two same type number: 010:010
8 10
Enter two same type number : 0x10: 0x10
16 0
(9.13):
#include <stdio.h>
#include <stdlib.h>
int main()
{
int fahrenheit;
float celsius;
printf("Enter a temperature value in Fahrenheit scale within 0 to 212: ");
scanf("%d",&fahrenheit);
celsius = (5.0/9.0)*(fahrenheit-32);
printf("\nValue of temperature in Celsius scale is %f\n",celsius);
return 0;
}