कंप्यूटर प्रोग्रामिंग/वेरिएबल/सी
variables.c
सम्पादन#include <stdio.h>
int main()
{
printf("Variables and Data Types\n");
int i = 1234567890;
float f = 1.2345678;
double d = 1.234567890123456;
char s[] = "string";
printf("int: %d\n", i);
printf("float: %.7f\n", f);
printf("double: %.15f\n", d);
printf("string: %s\n\n", s);
printf("Constants\n");
const float pi = 3.14159;
const char c[] = "Constant";
printf("%f\t%s\n\n", pi, c);
printf("Arithmetic Operators\n");
int a = 3;
int b = 2;
printf("a = %d\n", a);
printf("b = %d\n", b);
printf("a + b = %d\n", a + b);
printf("a - b = %d\n", a - b);
printf("a * b = %d\n", a * b);
printf("a / b = %d\n\n", a / b);
printf("Assignment Operators\n");
a += b;
printf("a += b is %d\n", a);
a -= b;
printf("a -= b is %d\n", a);
a *= b;
printf("a *= b is %d\n", a);
a /= b;
printf("a /= b is %d\n\n", a);
printf("User Input\n");
char username[256];
printf("What is your name? ");
scanf("%s", username);
printf("Hello %s!\n", username);
return 0;
}
कोशिश करो
सम्पादननिम्न कोड मुफ्त ऑनलाइन विकास के वातावरण में से एक में ऊपर कॉपी और पेस्ट करो या अपने खुद के कम्पाइलर/इंटरप्रेटर/आईडीई का उपयोग करें।