I was trying to make a program which was to much big for a noob like. it was approximatly 100 line(for noob like me,its big).But every time i run its loops aren't ending.So dicided to compile and check small parts of the code and I get bingo in fist part.here is that part
#include <stdio.h>
int main(){//B main
int cha,z;
printf("enter the alphabte in capital until you want the alphabats :- ");
scanf("%c",&z);
for(;z>=65;z--)
for(cha=65;cha<=z;cha++)
{
if(cha!=z)
printf("%c ",cha);
else
printf("%c \n",cha);
}
}//B main
.I have modified it it and if i enter c it should give an output like this:-
A B C
A B
A
But the loop does not ends and i keep getting something like this on terminal
! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~ � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �
thus try this part
#include <stdio.h>
int main(){
int a;
scanf("%d",&a);
printf("%d",a);
}
If I enter A then it should give me 65 as an output as A's ASCII value is 65 but it gives me following output
32766
but my this program give me correct ASCII values
#include <stdio.h>
#include <stdlib.h>
int main(){
int b,c;
b=0;
printf("\n these are ASCII values of all letters \n\n\n ");
while(b<=255)
{
printf("%c %d \n",b,b);
b=b+1;
}
}