Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
34 views4 pages

TEST

questions in c language

Uploaded by

thanikad.ei24
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views4 pages

TEST

questions in c language

Uploaded by

thanikad.ei24
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

1.

Convert decimal into


i) Octal
ii)Hexadecimal
iii)ASCII

#include <stdio.h>
int main()
{
int a;
printf("Enter a value:");
scanf("%d",&a);
printf("Octal value:%o\n",a);
printf("Hexadecimal value:%x\n",a);
printf("ASCII value: %c\n",a);

return 0;
}
O/P

2)Get an input from the user and print

Enter an integer:
Enter a float:
Etc…

#include <stdio.h>
int main()
{
int num;
float fix;
char ch;
char str[10];
double doom;
int oct;
int hex;
printf("Enter an integer:");
scanf("%d",&num);
printf("Enter a float:");
scanf("%f",&fix);
printf("Enter a char:");
scanf(" %c",&ch);
printf("Enter a string:");
scanf("%s",&str);
printf("Enter a double:");
scanf("%lf",&doom);
printf("Enter an octal:");
scanf("%o",&oct);
printf("Enter a hexadecimal:");
scanf("%x",&hex);
printf("Integer value:%d\n Float value:%f\n Character
value: %c\n String value:%s\n Double value:%lf\n Octal
value:%o\n Hexadecimal
value:%x\n",num,fix,ch,str,doom,oct,hex);

return 0;
}

OUTPUT

You might also like