Tag Archives: C

It's all about printf() and String Formatting

The printf() function was most probably introduced in C. The function, as most of the programmers know, prints formatted string according to a given format. PHP, being derived from C, has the same function with some added features. But in … Continue reading

Posted in Blog Post | Tagged , , | Leave a comment

Funky Little C Calculator

int main() { int num1, num2; char ch; printf(“Enter Two numbers:n”); scanf(“%d %d”,&num1,&num2); printf(“Function:a to add | s to subtract | m to multiply | d to divide \n”); ch = getch(); if(ch == ‘a’) printf(“The sum is: %d”, num1+num2); … Continue reading

Posted in Blog Post | Tagged | 2 Comments

Add a sequence of Positive Integers.c

The following program asks for positive integers. Input one after one. When the input is bigger than the sentinel value, the program terminates the input process and returns the sum of the integers entered so far J   /* Read … Continue reading

Posted in Blog Post | Tagged | Leave a comment

Summation in C

The following program takes two, yes just two integers and returns the sum of them. Very basic program but might be helpful for my fellow CSE friends at KU.   /* Add two numbers and print them out together with … Continue reading

Posted in Blog Post | Tagged | Leave a comment

Add N numbers of Positive integers in C

/*     Reads a positive number N. Then read N integers and * print them out together with their sum.*     Author: maSnun (masnun@gmail.com) */ #include <stdio.h> int main(void) { int n; /* The number of numbers to be read */ int … Continue reading

Posted in Blog Post | Tagged | Leave a comment

A Little C Program

I wrote the following program to see how fast C can handle files. I ran the codes both as a script (using TCC) and as a compiled executable. In both cases things happened lightning fast on my Celeron D with … Continue reading

Posted in Blog Post | Tagged | Leave a comment

All the Data Types in C

The following code listing demonstrates all the available data types in the C programming language. I have tested the code in the Tiny C Compiler aka TCC. main( ){int a; /* simple integer type */long int b; /* long integer … Continue reading

Posted in Blog Post | Tagged | Leave a comment

Virus Writing in C: Part 2

This is another piece of code I found on rohitlab.com. These codes are published for educational purposes. I don’t appreciate spreading viruses.   ==========================================   #include <windows.h> int WINAPI WinMain (HINSTANCE hThisInstance, HINSTANCE PrevInstance, LPSTR lpszArgument, int nFunsterStil)   { … Continue reading

Posted in Blog Post | Tagged | Leave a comment

Virus Writing in C: Part 1

I am studying C and C++ again to revise what I learnt a long time ago. This time, I am trying to be a bit malicious. Here’s a piece of C code I found the other day. =============================================== #include<conio.h>#include <stdio.h>#include … Continue reading

Posted in Blog Post | Tagged | Leave a comment

C, C++, C# , Java, Python, Perl, Ruby or PHP ?

As you can see, all of them are programming languages. A beginner might stumble upon the vast collection of languages out there. I found it quite confusing. I can’t master all the languages. I should work on only one language … Continue reading

Posted in Blog Post | Tagged , , | Leave a comment