Skip to content
Snippets Groups Projects
Commit c237487d authored by Mohamed Yasar arafath K M's avatar Mohamed Yasar arafath K M :speech_balloon:
Browse files

initial commit

parents
No related branches found
No related tags found
No related merge requests found
ascii.c 0 → 100644
#include <stdio.h>
//by for loop:
int main()
{
int ascii = 0;
printf("for loop :\n");
for(int i=0; i<=128; i++){
printf("ASCII: %d => %c\n", i, i);
}
//by while loop:
printf("While loop:\n");
while (ascii<=128)
{
printf("ASCII : %d ==> %c\n",ascii,ascii);
++ascii;
}
}
#include<stdio.h>
int main()
{
int intilise = 1;
int choice;
int range;
printf("Multiplication table");
printf("\nEnter a choice of a table :");
scanf("%d",&choice);
printf("\nEnter a range of the table :");
scanf("%d",&range);
printf("Doing do...while loop :\n");
do
{
printf("%d * %d = %d\n",intilise,choice,intilise*choice);
intilise +=1;
}while (intilise<=range);
printf("reversing the table\n");
do
{
printf("%d * %d = %d\n",range,choice,range*choice);
--range;
} while (range>0);
printf("Done");
}
#include<stdio.h>
int main()
{
int range,choice;
int initise;
printf("Multiplication table with for loop ");
printf("Enetr a choice of the table :");
scanf("%d",&choice);
printf("Enter the range of the table :");
scanf("%d",&range);
for (initise = 1; initise <= range; initise++)
{
printf("%d * %d = %d\n",initise,choice,initise*choice);
}
printf("Done\n");
printf("reversing the given table\n");
for (initise = initise -1 ; initise > 0; initise--)
{
printf("%d * %d = %d\n",initise,choice,initise*choice);
}
printf("Reversing done");
}
#include<stdio.h>
int main(){
int input,digit;
int nod=0;
printf("Enter a number :");
scanf("%d",&input);
for (input = input;input > 0;input = input / 10)
{
digit = input%10;
printf("Last digit of the %d : %d\n",input,digit);
++nod;
}
printf("Number digits you have entered : %d\n",nod);
printf("Done");
}
//do..while looping
#include<stdio.h>
int main(){
int a=1;
int choice;
int range;
printf("Multiplication table\n");
printf("\nEnter a table you want:");
scanf("%d",&choice);
printf("\nEnter a range of the table :");
scanf("%d",&range);
while (a<=range){
printf("%d * %d = %d\n",a,choice,choice*a);
++a;
}
printf("\nDone");
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment